1.2k questions

1.4k answers

361 comments

339 users

Categories

Sidebar
+1 vote
678 views
by ron-s-6919 (4.5k points)
When I create a CSV message, there is an empty row at the bottom.  It may be created because there is a line ending after the last row of data.  How can I remove this empty bottom row from the CSV message?

1 Answer

+2 votes
 
Best answer

To remove the last empty row do the following code:

//Remove last empty row
var csv = message.getNode('/');
csv = StringUtils.substringBeforeLast(csv, '\n');
qie.debug('csv: ' + csv);
message = qie.createTextMessage(csv);

Note: This will be the last mapping. If you convert the message back to a CSV then it will put the empty row back. This means that you can no longer use the message.setNode with a CSV path.

by brandon-w-8204 (34.1k points)
selected by nathan-c-4426
...