If statement condition

Hi friends,
I have got a variable, ObjTypeLineLeft, assigned a text “Object Type” . I need it to change to “object type” in the following activity but the output still " Object Type" after the if statement. What shall I do? Thank you.
image

Hi @Perri

Try Like below!

image

Regards

Possible to do it in the if condition :slight_smile: ? To change the ObjTypeLineLeft to “object type” and continue the sequence activities isnot “object type”

If ObjTypeLineLeft.ToLower isNot “object type”

Hi @Perri

As per my Understanding You have to Skip if the result is “object type”

Refer the screen Shot Below!

Regards

possible to combine the two tasks (change “Object Type” to lowercase and check it is not “object type”) using the if statement activity.
image

Hi @Perri

Check With the post 2 and Post 4

Refer the xaml below for better understanding!

test_1.xaml (5.3 KB)

Regards

1 Like

@Perri
kindly note the isNot Operator comapares the object references (identities) and not the values:
grafik

you should use following:

or working e.g. with the equals method from the string

1 Like

Thank you for sharing. This is my first time using VB in uipath :slight_smile: My intention is to convert the “Object Type” to lowercase and perform the following activity in the if condition is not “object type”. My problem now is my objTypeLineLeft contains “Object Type” and it did not convert to Lowercase so it go through the if condition. What shall I do if I want to use VB in uipath to meet this requirement?

Hi @Perri

“String Value”.ToLower will Convert to whole string to Lower Case!

Regards

Maybe you are looking for a case insensitive contains:
"ABC Object TYPE DEF".IndexOf("object type", StringComparison.OrdinalIgnoreCase) >=0
grafik

An alternate would would be a rege.isMatch like:
RegEx.IsMatch("Hello", "HELLO", RegexOptions.IgnoreCase)

bringing the string to lower Case still will be done as mentioned above by using toLower method

But kindly note:
Within the if condition a toLower/toUpper will not modify your origin variable value. So we just can simple do:

YourStringVar.toLower.Contains("object type")
YourStringVar.toLower.Equals("object type")
Not YourStringVar.toLower.Equals("object type")

If:—> ObjTypeLineLeft.ToLower<>“object type”

Here ObjTypeLineLeft.ToLower will apply lowercase operation
<> —> This is not eqal operator
So if your requirement is to check first if ObjTypeLineLeft is lower case or not then do following steps
If:—> ObjTypeLineLeft<>“object type”
THEN
assign ----> ObjTypeLineLeft=ObjTypeLineLeft.toLower

No. That’s not what conditions do. Conditions don’t set values, they check values. The result of your condition must be true or false. If you want to change a value, use Assign.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.