steps
Returns a steps object encapsulating properties and methods pertaining to the current DataMapper process.
This object is available in an Extract, Condition, Repeat or Multiple Conditions step script.
Methods and properties
The following table lists the methods and properties of the steps object. These are available in Extract, Condition, Repeat, and Action steps, depending on the file type.
Method | Description | File type |
---|---|---|
currentPosition | Returns the current position of the pointer in the data. Depending on the type of data being processed, the return value may be a string (e.g. XPath value in XML), an integer (e.g. line numbers in text ot tabular data), or a measure in millimeters(e.g. PDF data). | All |
currentLoopCounter | An integer value representing the current iteration of the containing loop. When loops are nested, you have access to the iteration for the current loop but not to any of the parent loops. Note: This variable is a counter so it starts at 1 as opposed to an index which usually starts at 0. | All |
currentPage | Returns an integer value representing the current page where the current position is located, inside the current record. | Text, PDF |
currentPageHeight | The height of the current page in millimeters. | |
currentPageWidth | The width of the current page in millimeters. | |
moveTo() | Moves the pointer in the source data file to another position. | All |
moveToNext() | Moves the position of the pointer in the source data file to the next line, row or node. The behavior and arguments are different for each emulation type: text, PDF, tabular (CSV), or XML. | All |
totalPages | An integer value representing the total number of pages inside the current record. | Text, PDF |
Example
if(steps.currentPage > curPage) {
steps.moveTo(0, steps.currentPosition+14); /* Moves the current position to 14 lines below the current position of the pointer in the data */
curPage++;
} else if(curLine.startsWith("LOAD FACTOR")) { /* Extracts data to the curLine variable until the string "LOAD FACTOR" is encountered */
break;
} else {
lineArray.push(curLine); /* Adds the current line value (extraction) to the array */
}