Read and Log Segments of a File Using a Set of Characters as Separators

The following sample reads and logs segments from a file using a set of characters as separators.

Note:

This script sample uses the define function, which is required for an entry point script (a script you attach to a script record and deploy). You must use the require function if you want to copy the script into the SuiteScript Debugger and test it. For more information, see SuiteScript 2.x Global Objects.

          /**
 * @NApiVersion 2.x
 * @NScriptType bankStatementParserPlugin
 */

define(['N/file', 'N/log'], function(file, log)   {
    return {
        parseBankStatement: function(context) {
            var statementFile = context.input.file;

            var statementSegmentIterator = statementFile.getSegments({separator: '\\|_|/'}).iterator();
            statementSegmentIterator.each(function (segment) {
                log.debug({
                    title: 'STATEMENT TEXT',
                    details: segment.value
                });
                return true;
            });
        }
    }
}); 

        

General Notices