If Activity goes only to the false condition


#1

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!


#2

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


#3

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


#4

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


#5

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


#6

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)


#7

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)


#8

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.


#9

it is working with the trim.
Thank you


#10

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


closed #11

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