We came across a change request today where we unfortunately had to stop using the handy action "TXT Number of Lines" - because now we need to count only the EoL chars CR+LF (\r\n).
Basically you can have a csv file opened in Excel and see only one record, but if you open it in notepad you see multiple lines. This is because it's depending on the EoL (CR+LF vs only LF).
There was no way of doing it using an out-of-the-box action in RoboTask (just with point-and-click, no code). No option to select which EoL chars should be considered in the action "TXT Number of Lines" (https://robotask.com/help/index.php?txt ... _lines.htm). Also no action for searching number of occurrences of a char in a string.
So we ended up using a JS Script action (in combination with a Read Text File action), using the following extremely simple code: https://stackoverflow.com/questions/400 ... -in-string
Code: Select all
var temp = RoboTaskApp().ExpandText("{File_Content}");
var count = (temp.match(/\r\n/g) || []).length;
RoboTaskApp().SetUserVariable("Current_File_nr_of_Lines", count);
Kind regards, Juanlu.