简体   繁体   中英

IIf in 2 data sets in SSRS

I have 2 data sets in my project. 1 data set returns a String Column.
Like below

Name

Praveen
Thomas
Joseph

Another data set also returns a string column like below

CMDBNetBiosName

Praveen
Joseph

I need to compare both the columns in data sets and need to return Yes in another column if both are same, return No if both are not same. I was trying to use below IIF expression for this but receiving errors.

=IIf(Sum(Fields!Name.Value) = Sum(Fields!CMDBNetBios.Value,"DataSet2"),"Yes","No")  

I'm pretty new to SSRS. Please help me to achieve this.

You can try:

=IIF(
ISNOTHING(
  Lookup(
    Fields!Name.Value,Fields!CMDBNetBios.Value, Fields!CMDBNetBios.Value, "DataSet2")),
"No","Yes")

This expressions works like this: if you have a tablix set to DataSet1 you can iterate over each row in it and look up the Name field in the DataSet2 , if the Name is present in any CMDBNetBiosName row it returns Yes otherwise No .

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM