If Activity goes only to the false condition

Hello ,
i am using if activity to check either a value exists in an excel file or not,
but this goes automatically to else even though the condition is true.
my condition is, if ArrayofString(0).contains(My variable).
Any help please!

1 Like

Try to check the output of your variable first. If data is available, then it should work.

1 Like

You may want to check if the data you are comparing has blank spaces (use String.Trim or String.TrimStart or String.TrimEnd)

1 Like

i have put the variable in a log message to see oit is value and it is available,
but still have the same problem

1 Like

We need to see more mate. Do you have log examples? Or code?

1 Like

Actually i have used Read column and its output is variable1.
then i have used variable2= string.Join(System.Environment.NewLine,variable1)
variable3= variable2.split({“Column_Name”},StringSplitOptions.RemoveEmptyEntries).
and the condition is , if (variable3(0).contains(MyValue)

1 Like

Actually i have used Read column and its output is variable1.
then i have used variable2= string.Join(System.Environment.NewLine,variable1)
variable3= variable2.split({“Column_Name”},StringSplitOptions.RemoveEmptyEntries).
and the condition is , if (variable3(0).contains(MyValue)

1 Like

Just try using ‘variable3(0).Trim.Contains(MyValue)’ but first try to log the content of ‘variable3(0).Trim’ and ‘MyValue.Trim’.

Probably you´re assuming values… just double check your are comparing what you expect.

2 Likes

it is working with the trim.
Thank you

1 Like

No problem! Just remember to Trim your variable to avoid side spaces.

2 Likes

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