Look up function inside IF condition visibility - SSRS

冷暖自知 提交于 2019-12-12 03:40:44

问题


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...


回答1:


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.




回答2:


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

=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:

Let me know if this helps.



来源:https://stackoverflow.com/questions/37591039/look-up-function-inside-if-condition-visibility-ssrs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!