Expression Builder for conditional formating with strings - ms-access

I am using Access report and using conditional highlighting.
I click on the expression Builder, and cant figure out how to check if the field is equal to "string1" or "string2" or "string3"
I tried: "AOI2" or "AOI3"
but then it don't Highlight anything.
EDIT
Tried: [linenum]="AOI2" Or [linenum]="SMD1" Or [linenum]="SMD2" Or [linenum]="AOI21" Or [linenum]="MOD15" Or [linenum]="MOD17" Or [linenum]="AOI3" Or [linenum]="AOI20" Or [linenum]="MOD14"
but does not work. looks like this.

For Conditional Formatting rule, have to use
Expression Is: [Fieldname]="AO12" Or [Fieldname]="AO13"

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.

SSRS "like" operator with nested iif

I have been trying to get a nested iif to work with the "like" operator and cannot come up with the right syntax. The basic code is shown below and before it is suggested, I have also tried this with the SWITCH operator with similar errors. The expression editor moves the error around based on the parenthesis. This particular expression is in the "fill" property of a matrix in an SSRS report. I really want to set the color on a match and leave it unchanged for no match. For the code below the expression editor shows an error on the first comma after the text "Preferred".
=iif((Fields!PHASE_TYPE.Value like "*Preferred*","ForestGreen","Blue") or
(Fields!PHASE_TYPE.Value like "*Maintain*","DarkSeaGreen","Red"))
Your syntax is not quite right for a IIF function. It takes 3 parameters, and you are only really giving it one.
You are going to need to change your expression to some like the one below.
=Switch(Fields!PHASE_TYPE.Value like "*Preferred*","ForestGreen",
Fields!PHASE_TYPE.Value like "*Maintain*","DarkSeaGreen",
True, "White") ' This last part will catch anything that does not match the above

Replace Zero with Blank in SSRS

Is it possible to replace 0 with blank in ssrs matrix. The expression
=IIF(IsNothing(Count(Fields!referralNo.Value)),0,Count(Fields!referralNo.Value))
is same as
=Count(Fields!referralNo.Value).
When I try =IIF(IsNothing(Count(Fields!referralNo.Value)),'',Count(Fields!referralNo.Value)) I'm getting error. Can somebody pls help!
you could use text box properties and set show zero as: option to blank.
I use this expression for percentage data - I like code better than format, but they both work ;)
=iif(Fields!STUFF_PCT.Value>0,Fields!STUFF_PCT.Value,"")
Use this format #,##0.00;-#,##0.00;""

show/hide columns in SSRS report 2012 based on Multiselect parameter

i have been trying to hide/show columns within my tablix based on multi value parameter , but whenever i am plugging in the expression in the column visibility properties it is not showing what i select from the parameter and hide what is not select.
Here is the expression:
=IIF(InStr(JOIN(Parameters!parameter.Value,", "),"value"),false,true)
any help???
If I understand correctly, you want to show the column if you select a value which contains "value". Right?
So the expression should be like below:
=IIF(InStr(JOIN(Parameters!parameter.Value,","),"value")>0,false,true)
I always get this wrong too. I think backwards. It is actually asking for the expression that will hide the column. SO Black_T is correct with his answer.
=IIF(InStr(JOIN(Parameters!Parameter.Value,","),"value")>0,false, true)
so whenever the expression picks up that value in the statement, it will return false, meaning that it should not hide it, and whenever it doesn't find it, well the returned product will also hide it! pretty ingenious!
Thanks and enjoy!
=IIF(InStr(JOIN(Parameters!parameter.Value,","),"value")>0,true,false)

Use multiple ReportItems in one expression in RDLC Report

I want to display page wise sum of 2 columns in footer.for that I am using following expression in footer
=Sum(ReportItems!col1.Value) + Sum(ReportItems!col2.Value)
but it gives following error
"The Value expression for the textrun refers to more than one report item. An expression in a page header or footer can refer to only one report item."
anybody knows how can I solve this issue and display page wise sum in footer ?
Thanks
Here is simple workaround for your problem:
Add single textbox to the body of the report and name it i.e. "SUM"
Add your expression to this textbox =ReportItems!col1.Value + ReportItems!col2.Value
For this textbox set visibility as hidden
In the footer refer to this hidden textbox using =ReportItems!SUM.Value
I usually use Custom code-feature of report for these operations. Just open Report Properties and choose Code-view. Just then write basic VB get/set-methods to save and sum values.
Referring to methods in TextBox expression goes just like this: =Code.[YourMethodNameHere].
For example, saving value:
=Code.SaveMyValue(Fields!MyVal.Value)
and getting value:
=Code.GetMyValue()