Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Retrieving .txt file from Ftp Server

Xhare
Tera Contributor

Hi SN Community,
I have a requirements to pull the logs from the ftp server and the file extension is .txt.

I want to get the data starts from row 14 until the end of row data.

How to achieve this?

I'm using below code, but still getting the data from row 1 until the last row

// The input value can be accessed through the variables named "line", "lineNumber" and "result"
// The function uses result variable to return parse result back.
(function(line, lineNumber, result) {
    if (lineNumber > 13) {
        var headers = gs.getProperty("ccc.log.extract.headers").split("|");
        var items = line.replace(/[^\x20-\x7E]/g, '').split(",");
        var map = {};

        for (var i = 0; i < items.length; i++) {
            map[headers[i]] = items[i];
        }

        result.addRow(map);
    }
})(line, lineNumber, result);

Xhare_0-1726477043348.png

 

0 REPLIES 0