0

I am using a parameter to change the background color of my field when the field string contains the parameter string .

I have used IndexOf, Contains, and instr. All three work, however they are all case sensitive. (i.e. when I search 'Dol' Dollar Tree and Doldrum are highlighted but not Sandolski etc.)

It is not the stored procedure, the correct records display, however the SSRS functions are what is my challenge.

I have tried toLowerInvariant but was receiving an error Help please.

gruff
  • 411
  • 1
  • 9
  • 25

1 Answers1

0

As I was writing this I checked my error and learned the issue..

I assumed the syntax was to pass my string as a parameter:

toLowerInvariant(Parameters!Param1.Value)

However the correct toLowerInvariant syntax is (in ssrs):

Parameters!Param1.Value.toLowerInvariant()

An explaination on toLowerInvariant can be found here: string.ToLower() and string.ToLowerInvariant()

And also I have found that this comparison is best done with a Switch (if you are comparing multiple parameters to the field). I have not noticed a performance impact between Field.IndexOf(@Param), Field.Contains(@Param), or Field.Instr(@Param)

My final code:

=switch( instr(Fields!Client.Value.toLowerInvariant(),Parameters!Client_Firm.Value.toLowerInvariant()) >= 1, "Cornsilk", instr(Fields!Client.Value.toLowerInvariant(),Parameters!KeyWord.Value.toLowerInvariant()) >= 1, "Cornsilk" )

Community
  • 1
  • 1
gruff
  • 411
  • 1
  • 9
  • 25