简体   繁体   中英

Using where clause in SSRS expression

I have a data set with multiple rows. The columns are name and plot ; plot is a binary image file. If I want to display the plot whose name is secondPlot , for example, how would I do this? 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.

I found if IIf function but am unsure on its usage or whether it's actually what I'm looking for anyway. =First(IIF(Fields!name.Value = "secondPlot", Fields.plot.Value, Nothing)) gives the error "The definition of the report '/MainReport' is invalid", for example.

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.

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.

在此处输入图片说明

For Expression select Name , operator = and value use ="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.

Right click the textbox and select Textbox properties / Fill tab, in background image pane use settings like this.

在此处输入图片说明

UPDATE:

If your image is PNG, BMP, JPEG, GIF or X-PNG you can select the proper MIME Type.

Also if your image is encoded in Base64 you can try:

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

In the Use this field: expression.

Don't use any expression for the textbox. Just use the image field as textbox background.

Let me know if you need further help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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