Getting an error in If Condition

Hi,

I am using IF Condition in my flow and i want to compare Variable value contains string or not. I tried below solution
JobType.Trim.Contains(“Environmental”)
JobType.Trim.Contains(row(“TYPE OF JOB”).ToString)
for both the condition program goes to else part. See screenshot. Please let me know how to correct this

Hi @Puneet_Singh1

If you want to Variable value contains string or no , to chcek if the string is null or empty please use

string.IsNullorEmpty(yourvariable) or yourvariable.ToString.Equals(“0”)

Hope this helps,

Thanks

Hello,

Can you check if there are two variables with the same name? The logic seems correct.

Thanks!

I want to check that variable contains below string or not
Regulatory
Standard
Enviromental
Stolen
Warrenty

So i am check below condition JobType.Trim.Contains(“Environmental”) and its not working

Hi @Puneet_Singh1 ,

Do you want to Check if the Variable will Contain all of the Above Strings or Any One of the Above String ?

Also, Could you print the value of JobType variable using a Write Line Activity

@Puneet_Singh1
give a trim to the row value also

Check JobType.Trim.contains(row(" ").tosting.Trim)

Any one from list

because sometimes when you trim the first value and not trimming the 2nd value , there might be a chance of mis count, the length of values may differ even it looks same

@Puneet_Singh1 ,

Check with the Below Expression :

{"Regulatory","Standard","Enviromental","Stolen","Warrenty"}.Any(Function(x)JobType.ToString.Trim.ToLower.Contains(x.ToString.ToLower.Trim))

Dont know the reason but its not working

@Puneet_Singh1 , Maybe there is a Spelling mistake in the Array

Working @supermanPunch Thanks

1 Like

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