[英]SSRS Simple WHERE Clause as expression
I'm pretty new to SSRS, may not be possible, but can I have a WHERE clause written in an expression? 我对SSRS很陌生,可能无法实现,但是我可以在表达式中编写WHERE子句吗?
I bassically have a dataset, but only want to assign the value to a text box based on the values in the dataset. 我的确有一个数据集,但只想根据数据集中的值将值分配给文本框。
In linq, it'd look like: 在linq中,它看起来像:
ds.FirstOrDefault(x => x.IsHeader)
but I can't work out the expression syntax. ds.FirstOrDefault(x => x.IsHeader)
但我无法计算出表达式语法。 There is the First function, but that just gives me the first record - not filtered as its applied after the filters. 有First函数,但这只是给我第一条记录-没有像在过滤器之后应用的那样进行过滤。
Anyone have any ideas - otherwise I need to split my dataset into multiple datasets, which is not ideal 任何人都有任何想法-否则我需要将我的数据集拆分为多个数据集,这并不理想
Thanks in advance 提前致谢
You can do filtering in the First Expression like so: 您可以在“第一个表达式”中进行过滤,如下所示:
=First(Fields!MiddleInitial.Value = "P")
=First(Fields!MiddleInitial.Value = Parameters!MiddleInitial.Value(0))
=First(Fields!MiddleInitial.Value,"AdventureWorks")
So for your example you'd have an expression that looks something like this (assuming your textbox is bound to ds
): 因此,对于您的示例,您将具有一个类似于以下内容的表达式(假设您的文本框绑定到ds
):
=First(Fields!IsHeader.Value = True)
If the textbox isn't bound to ds
you should be able to do this: 如果文本框未绑定到ds
,则应该可以执行以下操作:
=First(Fields!IsHeader.Value = True, "ds")
it's best to do filtering in your SQL query. 最好在您的SQL查询中进行过滤。 You can set up a parameter in your dataset to properly display the data you want. 您可以在数据集中设置参数以正确显示所需的数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.