SSRS Hide Field and Label - reporting-services

I have this basic formula that adds "Tel:" to the beginning of the text but I want to hide Tel: and the number if it's empty. How can I modify it to do this?
="Tel:" & Fields!nphone.Value
Thanks!

Try using a conditional function like this:
=IIf( Len(Fields!nphone.Value) > 0, "Tel:" & Fields!nphone.Value, Nothing )

Related

SSRS Font Color Using Wildcard parameter

Hi I have a report that i used a wild card search parameter so that i can pull record that contains a certain text.
For example: I need to search for subscription for Mary Johnson so on the keyword search box i just type "John". This set-up is working fine, but now I need to color that search keyword when found for each row. so i need assistance on expression code that mimics SQL syntax of LIKE in SSRS expression. I started to change the font color with =iif(Instr(Fields!ReportRecipients.Value)=Parameters!Keyword.Value,"Maroon","Black"), but it didnt work.
Please advise.
Sample
TOJo.eger#m.com; ruth.tuker#m.com;sandrae.espe#m.com; dan.gay#m.comIncludeReportTrueRenderFormatPDFSubjectDaily Report for IBC Medicare? was executed at #ExecutionTimeIncludeLinkFalsePriorityHIGH"
You can use some .net string functions directly in SSRS expressions. In your case you can use the Contains() function like this.
=IIF(
Fields!ReportRecipients.Value.Contains(Parameters!Keyword.Value),
"Maroon",
"Black"
)
If you are dealing with HTML and only want the search term to be highlighted then you can simply use this as the Value expression. You must leave the text box color properties as default.
=REPLACE(
Fields!ReportRecipients.Value,
Parameters!Keyword.Value,
"<span style=""color:red;"">" & Parameters!Keyword.Value & "</span>"
)
Finally, right-click the placeholder, choose properties and select Mark-up type as HTML
In this example, I used a country list and searched for the word "land", here's the results. The first column just uses the first method I described. The second column adds HTML tags.

How to use Like and another function or field from a form in Access?

I have a drop-down menu in a form where you choose the year from pre-entered values. That field is used in different queries to display different data depending on the year you've chosen from the drop down menu ([Field]).
I would like to use this field in a query with the Like operator an a Wild card character.
I have the form open and the value of the [Form]![SubForm]![Field] equals for example 2018. If I try Like "*2018" it works fine.
I tried this but it doesn't work: Like "*[Form]![SubForm]![Field]"
Any ideas on how I could achieve this?
Your original code is taking the text as is.
Like "*[Form]![SubForm]![Field]" is searching for text that is like [Form]![SubForm]![Field].
You need to look for text that is like the contents of the control, not the reference to the control:
Like "*" & [Form]![SubForm]![Field]
The code above concatenates * with the value held in the control.

SSRS MailTo Expression

I have a textbox with the following expression- ="MailTo:example#gmail.com".
I have tried with and without the quotes. With the quotes, I just get the actual text, which is MailTo:example#gmail.com. Without the quotes, I receive an error about using a colon.
What I want to do is hyperlink the email address so that it can be clicked on in the report, and have outlook open. How can I achieve this?
Apparently, the above does not describe my problem enough...let's see if this works...
Right click the textbox and go to Textbox properties, in the Action tab select Go to URL and use the expression you need:
="mailTo:example#gmail.com"
Also if you set the Place Holder Markup Type property to HTML you can use an expression like this:
="<a href=" & CHR(34) &
"mailto:alejandro.zuleta#example.com" & Chr(34) &
">send mail to alejandro</a>"
Which results in a hyperlink to the specified mail address that executes your default E-Mail client to send the mail.
Let me know if this helps.

How to remove trailing zeros using ssrs?

I have a column DECIMAL(18,4). when I insert data like 123.45 it becomes 123.4500
I want to show it in SSRS like 123.45.
How to remove those zeros in SSRS?
Depending on what exporting formats your need you can set the number formatting to 0.####;(0.####)
I know this is compatible with the SSRS viewer and exporting to PDF, but Excel would take 123.0000 and show it as 123. instead of just 123
I dont agree with the accepted answer, casting to a string is another workaround:
=Str(NumericValueWithVariableDecimalPlaces)
Unfortunately a consequence is no numeric formatting settings will apply and setting cell Alignments to right causes numbers to be misaligned.
You can change the data type returned to SSRS to a FLOAT. That should do it :-)
Open SSRS Query Designer and add:
SELECT CONVERT(DOUBLE PERCISION,FIELD) FROM TABLE SOURCE
OR add to your select result from your Store Procedure source
SELECT CONVERT(DOUBLE PERCISION,FIELD) FROM TABLE SOURCE
This will remove trailing zeros: CDbl(Fields!YOURFIELD.Value)
This can be done in the SQL which you can do by casting the value to DECIMAL(18,2)
ex:
CAST(FieldName as DECIMAL(18,2))
but if you really want to do it in SSRS. You can right click on the textbox that the field is displaying in and go to textbox properties. In the pop-up box choose 'Number' and set the Category to 'Number' and then decimal places to 2. This should correctly display the value.
You could also right click on the textbox and go to expression and say this in the expression popup box:
=FormatNumber(Fields!FieldName.Value,2)
I try and find solution:
I use Expression for value:
=IIf(IsNothing(Fields!FieldName.Value), "", IIf(IsNothing(Fields!FieldName.Value), "-", CInt(Fields!FieldName.Value * 10000) / 10000))

Hide Blank Data

I would like to hide empty fields, not show a blank line. How can i do this?
Add a row to your details group to hold the potential list of values. Drop a single textbox field that displays a calculated field. The calculated field should be an expression similar to the below to display up to 4 sequential fields.
=Fields!ExampleField1.Value & IIF(Fields!ExampleField1.Value.ToString().Length >0,vbCrLf,"") &
Fields!ExampleField2.Value & IIF(Fields!ExampleField2.Value.ToString().Length >0,vbCrLf,"") &
Fields!ExampleField3.Value & IIF(Fields!ExampleField3.Value.ToString().Length >0,vbCrLf,"") &
Fields!ExampleField4.Value
Select the TableRow (not the individual cells) you want to make conditionally suppressed, then enter the conditional suppression formula into the Visibility - Hidden property expression on the Properties tab.