Look up function inside IF condition visibility -

2019-09-04 22:03发布

I have a SSRS report with one tablix and i want to hide the tablix based on a condition. I am using two datasets there. The tablix contains dataset1 records. I want to check the dataset2 with Pno and if then only need to display that Pno in tablix.

Dataset1                        
Pno Group
 1  A
2   S
3   D
4   F
Dataset2
Pno Supply  Demand  Group
1           A
3           D
5           B
6           R
Now I want to display only 
Pno Group
1   A
3   D

I am using the following condition.

=IIF(Lookup(Fields!Group.Value, Fields!Pno.Value, Fields!Pno.value, "Dataset2"), True, False)

But it doesn't filter the records. Can anyone help me to solve this? Thanks in advance...

2条回答
放荡不羁爱自由
2楼-- · 2019-09-04 22:12

Try using this expression in for hidden in the Row visibility window:

enter image description here

=IIF(ISNOTHING(ReportItems!Group.Value),True,False)

ReportTems!Group is the name of the cell where you are using the Lookup function, replace Group by the actual name of the cell:

=Lookup(Fields!Group.Value, Fields!Pno.Value, Fields!Pno.value, "Dataset2")

If your cell has a different name select the cell and press F4 to see the properties window, look for the name property.

It will produce:

enter image description here

Let me know if this helps.

查看更多
何必那么认真
3楼-- · 2019-09-04 22:27

I think that you may just have your Lookup parameters mixed up. Try this:

=IIF(Lookup(Fields!Pno.Value, Fields!Pno.value, Fields!Group.Value, "Dataset2"), True, False)

One step further:

=IIF(Lookup(Fields!Pno.Value, Fields!Pno.value, Fields!Group.Value, "Dataset2") <> "", True, False)

In a Lookup, the first 2 parameters are the fields that need to match, the third is the value being returned, the fourth is the dataset being queried.

查看更多
登录 后发表回答