cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3813
Views
16
Helpful
7
Replies

UCCX if Step to check if contains data

Martin Bauer
Level 1
Level 1

Hello everyone

 

I'm trying to make a script to check if the ANI number is already in a .txt file.

 

I can get the file from UCCX and copy the contents to a variable, but I'm not sure on how to make this IF step. Or better, is it possible to do it with IF?

The data in the file is something like this:

U"\r\n2008u\n\r\n2007u\n\r\n2068u\n\r\n2069"

 

Using the if step how can I check if the ANI 2008, for example is in the file?

 

Thanks.

1 Accepted Solution

Accepted Solutions

Try .contains method.

 

If (variable.contains("2008")) Then

 

View solution in original post

7 Replies 7

Try .contains method.

 

If (variable.contains("2008")) Then

 

Yeap. That's it.

 

Do you know where can I get all this syntax? In the UCCX language reference book this kind of syntax are not mentioned.

Thank you very much.

You can refer to Java language syntax because UCCX scripting is based on Java.
Also you can program on straight java in script editor.

Thank you.

Please, please, please do a null check against the variable when you use methods, particularly for variables that source data from documents. I see this all the time, a string variable can be set to null on an invalid document and .contains on a null object will throw an exception in the script.

If (variable != null && variable.contains("2008")) Then

 

Should prevent any issues in the future.

 

Regards,

Tanner Ezell

Tanner Ezell www.ctilogic.com

Thank you very much Tanner.

very useful method for UCCX scripting. Thank you so much