Using where clause in SSRS expression - sql-server

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.

Related

Hide or Unhide based on tablix in SSRS

I am supposed to show textbox based on Tablix. It will be appear on the page where the tablix exists. It stops showing when the report page doesn't exist on the page. How can I achieve it?
I am thinking of using reportItems but I don't know exactly how.
I have already one column in my tablix for using reportitem. Can I have two report items in the same tablix( that one I am not sure too)?
Am I clear in explaining my issue?
Rather than checking if the Tablix exists on a page, perhaps think about what data causes the Tablix to exist.
Say your Tablix is displaying data on dogs, but on one of your pages you don't have any valid dogs, so no Tablix. In this case you could check for this in the Hidden property of the Text Box:
=IIF(Count(Fields!DOG_ID.Value) = 0, True, False)
(For the opposite of this, a Tablix has a NoRowsMessage property you can set rather than needing an extra Text Box.)
Goto the properties of the text box and then goto Visibility. Select "Show or hide based on expression" and click on the [fx] button.
To show or hide depending if the Tablix returns any data or not:
Then enter the below: =iif(CountRows("NameOfTheDataseOfTheTablix") < 1,True, False)

SSRS : how to add an icon with a data region

My aim is to have the icon , combined with the results of my dataset
I'm adding an icon in my textbox. The textbox is part of a table , within a list.
Then I put the name of the image plus the name of my dataset (as you can see below)
"mailsocialmedia128" + Fields!MyFieldname.Value
Issue is the icon is only appearing when the dataset is empty. But when the dataset is not empty , I have a ... red cross (see picture below).
How can I have the icon and the data related , inside of the text box?
Thanks in advance for any insights you will be able to provide
Rather than trying to achieve all of this in a single text box, you can instead create multiple objects within the area.
Right click the text box and select Insert -> Rectangle
You can then insert both a Text box to display the text and a separate Image control to this area, and one won't affect the other.
It could look something like this in design view
And like this in preview
Let me know if this is helpful, or if you require further assistance

Limit data based on UniqueCount

I have charts on a tab, that should only show if 1 value from a column filter is selected.
For example if a field named: BUSINESS_UNIT has values of "HR","FIN","IT" The charts should only show data if 1 value is filtered on. Such as "HR."
These charts do not contain the BUSINESS_UNIT field itself.
I tried using the Limit Data Using expression, but for some reason the limit expression UniqueCount(BUSINESS_UNIT)=1 doesn't work.
How would I hide the data in the charts, unless 1 BUSINESS_UNIT is selected?
What you could do is hide the filters panel and create radio buttons on a new text area for each property to mark data. If you need help setting this up let me know. Then in your visualisations limit data using markings and show an empty visualisation if no items are marked.
One downside to this is maintenance, if the values change you will have to update the UI.
Another possible solution (untested) is to change the filter panel properties from checkboxes to radio buttons.
Filter Panel Properties:
http://stn.spotfire.com/spotfire_client_help/filter/filter_panel_properties.htm
You want it to look something like this:
http://stn.spotfire.com/spotfire_client_help/filter/filter_radio_buttons.htm

Data Values not visible in the DevExpress grid

I am using DevExpress Winforms for representing my Grid Structure.
What is happening is that i'm using DevExpress in an already developed application.
I am assigning the DataSet table to DataSource in the grid layout view.
I am using XtraGrid and Column Header is in camelcase.
What is happening is that Column Headings are being displayed, it is showing that 30 entries are loaded but nothing is being displayed. As in no data value is visible.We found the issue field name is case sensitive.
How do we handle this ?
Any helps/ leads will be appreciated.
If you have visible columns and you can see rows with empty cells I'll bet the field names (GridColumn.FieldName) do not match with column names of your DataTable.
The field names have nothing to do with the header captions (GridColumn.Caption) but the caption is automatically determined out of the fieldname if it is not set to another string.

Reporting Services 2008 Visibility

Using reporting services and trying to hide a field placeholder value when it does not equal "View" The value is hyperlinked to a subreport and is located in a bordered textbox inside a tablix. If I use the visibility feature for the text box, I can hide the non-view hyperlinks with an expression, but it hides the entire textbox and the textbox borders go away for that cell--I really want them to remain and just show the empty cell. If, instead, I try to hide the value on the placeholder level, which does not present the visibility option, and I attempt to evaluate the expression for the placeholder value to Nothing or '' when it is not valued as "View" then I get a hyperlink dash display in the column where I think it's attempting to render an unvalued hyperlink, which I really don't want. I just want an empty, bordered textbox.
Any way around this?
One solution is to change the visibility of the textbox value like this
IIF(fields(View.value) = 'true' , fields(TextBoxVariable.value), " ")
note that " " at the end will hide your dash
Or you can put a rectangle in the tablix cell and set its border, the you can put a textbox inside of the rectangle and change the visibilityof the textbox easily
put you link action on placeholder properties: Action - go to subreport, then put hidden expression on textbox: IIF(Fields!NameFields="View", true, false)
it works for me.
I know this is an old post, but I recently ran into this same issue.
Remove the expression from the text box properties and add it to the expression box of the field (right-click on the field and instead of choosing Text Box Properties>Visibility, choose Expression from the context menu). This will replace the field with an expression and the border lines will still exist.
Here's what I added to my expression:
=IIF(FORMAT(CDATE(Fields!ApprovedDate.Value),"dd-mm-yyyy") > "01-01-1980",Fields!ApprovedDate.Value," ")
I think that the easiest way to get rid off this hyperlink dash, is to change the font effect of the text-box. Just select Font-tab from text-box properties and from there, click fx-button of Effects and put somethin like this as expression:
=IIF(Fields!YourValueField.Value is nothing, "None", "Underline")

Resources