简体   繁体   English

IIf 在 SSRS 的 2 个数据集中

[英]IIf in 2 data sets in SSRS

I have 2 data sets in my project.我的项目中有 2 个数据集。 1 data set returns a String Column. 1 个数据集返回一个字符串列。
Like below像下面

Name姓名

Praveen普拉文
Thomas托马斯
Joseph约瑟夫

Another data set also returns a string column like below另一个数据集也返回一个字符串列,如下所示

CMDBNetBiosName 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.我需要比较数据集中的两列,如果两者相同,则需要在另一列中返回 Yes,如果两者不同,则返回 No。 I was trying to use below IIF expression for this but receiving errors.我试图为此使用以下 IIF 表达式,但收到错误。

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

I'm pretty new to SSRS.我对 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 .此表达式的工作方式如下:如果您将 tablix 设置为DataSet1您可以遍历其中的每一行并查找DataSet2Name字段,如果 Name 存在于任何CMDBNetBiosName行中,则返回Yes否则返回No

Hope it helps.希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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