简体   繁体   English

在SSRS表达式中使用where子句

[英]Using where clause in SSRS expression

I have a data set with multiple rows. 我有一个包含多行的数据集。 The columns are name and plot ; 列是nameplot ; plot is a binary image file. plot是一个二进制图像文件。 If I want to display the plot whose name is secondPlot , for example, how would I do this? 例如,如果要显示namesecondPlot的图, secondPlot I can display just the first plot with =First(Fields!plot.Value, "DataSet1") but haven't had any luck with retrieving a plot with a certain name value. 我可以使用=First(Fields!plot.Value, "DataSet1")仅显示第一个图,但是检索带有特定name值的plot没有任何运气。

I found if IIf function but am unsure on its usage or whether it's actually what I'm looking for anyway. 我发现IIf起作用,但不确定其用途还是实际上是我要寻找的东西。 =First(IIF(Fields!name.Value = "secondPlot", Fields.plot.Value, Nothing)) gives the error "The definition of the report '/MainReport' is invalid", for example. =First(IIF(Fields!name.Value = "secondPlot", Fields.plot.Value, Nothing))给出错误“报告'/ MainReport'的定义无效”。

For clarification, I'm typing this in Insert>Image>Database source. 为了澄清起见,我在“插入”>“图像”>“数据库源”中键入此内容。

Add a tablix component to your report, then assign your dataset to your tablix in the DataSetName property. 将tablix组件添加到报表中,然后在DataSetName属性中将数据集分配给tablix。

Delete columns and rows leaving only a textbox. 删除列和行,仅保留文本框。 Right click in the tablix and select Tablix properties... go to filter tab and add a new filter. 右键单击tablix,然后选择Tablix properties...转到filter选项卡并添加一个新的过滤器。

在此处输入图片说明

For Expression select Name , operator = and value use ="secondPlot" . 对于Expression,选择Name ,operator =和value使用="secondPlot"

The tablix will filter the row that contain secondPlot name and you can show the image in the tablix textbox by configuring background image property in the Fill tab. tablix将过滤包含secondPlot名称的行,您可以通过在Fill选项卡中配置背景图像属性来在tablix文本框中显示图像。

Right click the textbox and select Textbox properties / Fill tab, in background image pane use settings like this. 右键单击文本框,然后选择“ Textbox properties /填充”选项卡,在背景图像窗格中使用类似的设置。

在此处输入图片说明

UPDATE: 更新:

If your image is PNG, BMP, JPEG, GIF or X-PNG you can select the proper MIME Type. 如果您的图像是PNG,BMP,JPEG,GIF或X-PNG,则可以选择适当的MIME类型。

Also if your image is encoded in Base64 you can try: 另外,如果您的图片是使用Base64编码的,则可以尝试:

=System.Convert.FromBase64String(Fields!Plot.Value)

In the Use this field: expression. 在“ Use this field:表达式。

Don't use any expression for the textbox. 不要在文本框中使用任何表达式。 Just use the image field as textbox background. 只需将图像字段用作文本框背景即可。

Let me know if you need further help. 让我知道您是否需要进一步的帮助。

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

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