Add option in Action TXT Number of Lines to select EoL char

Post comments and suggestions for RoboTask here

Add option in Action TXT Number of Lines to select EoL char

Postby juanlu » Thu Jul 16, 2020 8:36 am

Hi Oleg,

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" ( 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:
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);

But obviously it would be much better to have an option in the action "TXT Number of Lines" instead of having to code. Would you please consider this enhancement?

Kind regards, Juanlu.
Posts: 32
Joined: Wed Jul 31, 2019 12:33 am

Return to Suggestions

Who is online

Users browsing this forum: No registered users and 2 guests