02-19-2019 12:59 AM
I have the following script. In the document (txt) I write a record which I record. If I want to delete it, then I write "blank" in this document.
How would you then read this document in order to determine if it was blank in the document or is it in the record document?
02-19-2019 05:05 AM
02-19-2019 11:12 PM
It's a .txt file that I read from document repository
02-20-2019 12:09 PM
Using the Set step to "read" a document, will put that documents contents in your variable.
Example:
Read a file from the Document Repository
Set file_contents = DOC[myfilename.txt]
BONUS: Read a file from the web
Set file_contents = URL[http://servername/myfilename.txt]
In each case, you would then just work with the variable as a normal variable, checking for null, empty, or specific content.
/* Check for null or empty */ If (file_contents == null || file_contents.trim() == "") True /* File has no content */
Goto Default Path False If (file_contents == "banana")
True
/* Anthony was here */
As @Jonathan Schulenberg said, watch out for situations where you are trying to read a file which does not exist; your script will abort unless you catch the Exception
If you're new or just plain curious about Exceptions, you might find my article on discovering exceptions helpful: https://community.cisco.com/t5/collaboration-voice-and-video/uccx-discovering-exceptions/ta-p/3124590
Good luck, and let us know how it goes.
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