Row condition not working for all

hI, I have this code.

service 1 is a variable which is “CALL” or “ABC” (in a loop.)

IF activity: row("(On-Demand)").ToString Like “Per “+service1+”” And row(“Pricing Unit”).ToString Like “per Day”

This is the table the above code is retrieving info from.

However, the code works when the variable is “CALL” but does not work when the variable is “ABC”.

Any suggestions?

Thank you xoxo

Check the spaces in your cell value.

Hi.

You can also do it like this:

row("(On-Demand)").ToString.Trim.ToUpper.Contains(“PER “+service1.Trim.ToUpper) And row(“Pricing Unit”).ToString.Trim.ToUpper.Contains(“PER DAY”)

You can also replace .Contains with .Equals if desired.
I used .ToUpper and compared with all upper case so it is not case-sensitive.

Regards.

It works. But I have a question.
In the code, u put toUpper to make it all upper case. But in my table not all are upper case. Then how does it match?

It will make both the values upper case and compare, that way case will not be a issue if there is a lower/upper/both

1 Like

Like nadim said, it will compare both values in the upper case, so if one side is lower case, it will still compare them both in upper case and they will match.

here’s an example:
a=“Abc”
b=“abc”
If a.ToUpper = b.ToUpper

That is like comparing “ABC” = “ABC”, therefore it is True. Without the .ToUpper, it is “Abc” = “abc” which is False.

I hope that clarifies.

Regards.

1 Like