File.getSegments(options)
Method Description |
Method used to return the iterator of segments delimited by a separator. Separator is included in each segment. Empty separator is not allowed. |
Returns |
Iterator |
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Since |
2019.1 |
Parameters
The options parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
string |
required |
The separator to use to divide the segments. For example, if you specify a newline character as the separator, this method returns an iterator where each segment is a single line in the file. |
2019.1 |
Errors
Error Code |
Message |
Thrown If |
---|---|---|
|
Segment separator must not be empty. |
The |
|
You have entered an invalid type argument: <passed type argument> |
The |
|
<name of missing parameter> |
A required argument is not passed. |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/file Module Script Samples.
// Add additional code
...
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;
...
// Add additional code