[英]SSRS two datasets in one report
I have a SSRS report with two datasets. 我有一个包含两个数据集的SSRS报告。 My report has one table with all fields from dataset 1. Is it possible to show the field from dataset 2 if the id field from dataset 1 = the id field from dataset 2? 我的报告有一张表,其中包含数据集1的所有字段。如果数据集1的id字段=数据集2的id字段,是否可以显示数据集2的字段?
I've tried using an expression on the field in the table to point to the field in dataset 2 but there is no link between the 2 datasets which I think I need. 我尝试在表中的字段上使用表达式来指向数据集2中的字段,但是我认为我需要的2个数据集之间没有链接。 are you able to do a select clause within the expression on the report? 您能够在报表的表达式中执行select子句吗?
any guidance would be appreciated 任何指导将不胜感激
I have tried the below as the expression but it doesn't work : 我已经尝试过下面的表达式,但是它不起作用:
=iif Sum(Fields!ID.Value, "DataSet2")=Sum(Fields!ID.Value, "DataSet3") then First(Fields!total.Value, "DataSet3")
Your question is very classic case of SSRS. 您的问题是SSRS的经典案例。
You have 2 ways to achieve this 您有两种方法可以实现这一目标
Method1: Use subreport to display one report in another report 方法1:使用子报表在另一个报表中显示一个报表
Method2: Use lookupset function in SSRS 方法2:在SSRS中使用lookupset函数
In the Expression dialog box, modify the expression to look like this: 在“表达式”对话框中,将表达式修改为如下所示:
=join(Lookupset(Fields!ID.Value,Fields!ID.Value,Fields!Subject.Value,"DataSet2"),",")
The following screenshot is for your reference(The tablix is to use DataSet1): 以下屏幕快照仅供参考(tablix将使用DataSet1):
Refrences: Refrences:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.