Showing posts with label quotcapital. Show all posts
Showing posts with label quotcapital. Show all posts

Friday, March 23, 2012

Problem with IIF and Like comparison

I am having a problem with the following expression

=IIf(Fields!client_short_name.Value Like "Capital% ", 1,0)

I am wanting to get a value of 1 if the field has any of the valid values that begin with Capital but it always returns 0. Any ideas?

You may have better luck with the Instr command.|||

Do you know what the proper syntax would be in this example? I'm struggling.

|||

Did you try to use LIKE "Capital" (without using %)

I don't know try that.

|||

I believe it would be

Code Snippet

=IIf(Instr(Fields!client_short_name.Value,"Capital") = 1,1,0)

Of course, this isn't exactly like your expression because the instr looks for the word anyware in the string. You could also use the left function

Code Snippet

=IIF(Left(Fields!client_short_name.Value,7) = "Capital",1,0)