If Statement Condition - Starts With or Contains

Steven Parker
Giga Sage

Can someone please tell me why neither "Starts With" or "Contains" will send this workflow down the "Yes" path?  Clearly when I log the variable the IP Address starts with 192.168.  The IF activity is going down the "No" path every time.

find_real_file.png

find_real_file.png

I feel like I must be missing something simple and I am tired of looking at this...


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
1 ACCEPTED SOLUTION

Mike Patel
Tera Sage

You can also do advance script like

if(current.variables.XXXXXXX.toString().indexOf("192.168") > -1 ){

answer = 'yes';

}else{

answer = 'no';

}

View solution in original post

5 REPLIES 5

Mike Patel
Tera Sage

You can also do advance script like

if(current.variables.XXXXXXX.toString().indexOf("192.168") > -1 ){

answer = 'yes';

}else{

answer = 'no';

}

Ok that works...tested that earlier, but left the .toString() out of it.

Is there a similiar script for "startsWith" or in a run script is "IndexOf" your only option?


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

try doing ( I have never used startsWith but give it a try)

if(current.variables.XXXXXXX.toString().startsWith("192.168") ){

Thanks for this because this helped me with a script I was working on.  👍