简体   繁体   English

SSRS使用与不同数据集不同的列过滤

[英]SSRS Filter with a different column from a different dataset

I want to filter my column, let's call it AllStudentID from dataset1 with another column from a different datset. 我想过滤我的列,让我们从dataset1用另一个来自不同数据集的列调用AllStudentID。

Dataset1 had many column such as AllStudentID, Class, Time, Location. Dataset1有很多列,例如AllStudentID,Class,Time,Location。 Dataset2 has other columns but i'm focused on a similar column called OnCampusID. Dataset2有其他列,但我专注于一个名为OnCampusID的类似列。

I've tried looking into using a filter but since the report itself has the columns from Dataset1, i run into an issue where if I select the column in dataset2, it always gives a First(OnCampusID). 我已经尝试过使用过滤器,但由于报告本身有来自Dataset1的列,我遇到了一个问题,如果我选择dataset2中的列,它总是给出First(OnCampusID)。 And I don't want that. 我不希望这样。

I looked into IIF() but again, i'm using a column from a different datset plus if let's say that they are NOT equal, I don't want to display anything, instead of putting something there. 我查看了IIF()但是,我再次使用来自不同数据集的列,如果让我们说它们不相等,我不想显示任何东西,而不是在那里放东西。 I know that you have to put a result if true and a result if false. 我知道如果为true,则必须输出结果,如果为false,则必须输出结果。 If I"m thinking of it in terms of SQL statements, it's like having a WHERE clause WHERE AllStudentID=OnCampusID. 如果我在SQL语句方面考虑它,就像有一个WHERE子句WHERE AllStudentID = OnCampusID。

I tried running a Parameter but I don't want the select part on the top but rather have the report filtered already. 我尝试运行参数,但我不希望选择部分在顶部,而是已经过滤了报告。

Am I missing something? 我错过了什么吗? I know it has to be simple. 我知道它必须简单。

Mind you, the following example above is just an example i made up, not the real thing. 请注意,上面的例子只是我编写的一个例子,而不是真实的例子。

Assuming that each OnCampusID only appears once in Dataset2 then you can do a Lookup expression to filter it: 假设每个OnCampusID仅在Dataset2中出现一次,那么您可以执行Lookup表达式来过滤它:

=IIF(IsNothing(Lookup(Fields!AllStudentID.Value, Fields!OnCampusID.Value, Fields!OnCampusID.Value, "Dataset2")), False, True)

If OnCampusID appears more than once in Dataset2 then do the same thing using LookupSet . 如果OnCampusID在Dataset2中出现多次,那么使用LookupSet执行相同的操作。

To get the graduate field from Dataset2 just to a Lookup in the Value of the cell, like so: 要将数据集2中的研究生字段添加到单元格ValueLookup中,如下所示:

=Lookup(Fields!AllStudentID.Value, Fields!OnCampusID.Value, Fields!Graduate.Value, "Dataset2")

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

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