06-18-2015 11:59 AM - edited 03-15-2019 06:08 AM
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.
Solved! Go to Solution.
06-18-2015 08:24 PM
06-18-2015 08:24 PM
Try .contains method.
If (variable.contains("2008")) Then
06-19-2015 06:17 AM
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.
06-19-2015 08:27 AM
You can refer to Java language syntax because UCCX scripting is based on Java.
Also you can program on straight java in script editor.
06-19-2015 09:30 AM
Thank you.
06-19-2015 10:43 AM
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
06-19-2015 10:59 AM
Thank you very much Tanner.
10-20-2016 03:35 PM
very useful method for UCCX scripting. Thank you so much
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide