Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


bsmith
2017-05-24T19:47:44Z
I'm having trouble formatting a variable for writing to a file.

I have the pretty simply task of reading a text file and writing lines starting with text string "Error" to a new file.

Can you provide guidance for the variable to use for this text string to include the entire contents of a line starting with "Error" from the standard output of the previous Read file task?
Sponsor
Forum information
Gary_W
2017-06-16T19:30:55Z
In the Write File task, make sure there is a loop reading the previous task's stdout, then set line break to NoLineBreak and set the value to:

{LOGIC(If|String|{STRING(Substring|{LOOP(CurrentValueXLine)}|0|5)}|==|Error|{LOOP(CurrentValueXLine)}
|)}

Test if the first 5 characters of the line are "Error". If so, return the line plus the carriage return (note the embedded carriage return) else return nothing. If you need to apply a more comples pattern, you may need to use a regular expression:

{LOGIC(If|String|{REGEX(Replace|{LOOP(CurrentValueXLine)}|^(Error).*|$1)}|==|Error|{LOOP(CurrentValueXLine)}
|)}

Here it's just looking to see if the line starts with "Error" but a more complex set of criteria could be allowed for.
Support
2017-06-19T16:40:14Z
You cannot set a Variable with a Variable (yet). You can only check or return the modified the result. Only way to set is to use the Set Variable Task.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top