Table of Contents

Search

  1. Preface
  2. Introduction to Data Transformation
  3. Data Processor Transformation
  4. Wizard Input and Output Formats
  5. Relational Input and Output
  6. XMap
  7. Libraries
  8. Schema Object
  9. Command Line Interface
  10. Scripts
  11. Parsers
  12. Script Ports
  13. Document Processors
  14. Formats
  15. Data Holders
  16. Anchors
  17. Transformers
  18. Actions
  19. Serializers
  20. Mappers
  21. Locators, Keys, and Indexing
  22. Streamers
  23. Validators, Notifications, and Failure Handling
  24. Validation Rules
  25. Custom Script Components

Data Transformation User Guide

Data Transformation User Guide

JavaScript Extensions

JavaScript Extensions

The JavaScript processor implements the following methods that are not defined in standard JavaScript. You can use these extensions in any location where the Script accepts a JavaScript expression.
Most of the functions are JavaScript implementations of transformers or actions.
extra.sum(number1, number 2, ...)
Returns the sum of the parameters.
extra.allSame(param1, param2, ...)
Returns true if all the parameters have the same value.
lookup.<lookup_name>(key)
This function accesses a global lookup table by name.
In the Script, define a global
InlineTable
or
XMLLookupTable
. Then, in a JavaScript expression, you can access the table. For example, if you define a global
InlineTable
called
USPresidents
,
lookup.USPresidents(1)
returns
George Washington
.
For more information, see LookupTransformer.
extra.formatDate(date, input_format, output_format)
Formats a date or time. For more information, see DateFormatICU.
extra.substitute(text, oldSubstring, newSubstring, useRegex)
Replaces all instances of a substring with another substring. If
useRegex
is true, the method interprets
oldSubstring
as a regular expression.
extra.formatNumber(number, size_of_integer_part, number_of_decimals, sign, insert_decimal_point, unit_type)
Formats a number. For more information, see FormatNumber.
extra.insertString(text, injections_place, string_to_inject)
Inserts a string into the text. For more information, see InjectString.
extra.formatTransformationStartTime(format)
Outputs the date and/or time at which the transformation started running. For more information, see TransformationStartTime.
extra.resize(text, size, padding_character, align)
Fits the input text to a specified size, padding or truncating as required. For more information, see Resize.
extra.dateAdd(date_format, date, days_to_add)
Increments a date by a given number of days. For more information about the
date_format
, see DateFormatICU.
extra.dateAddMonths(date_format, date, months_to_add)
Increments a date by a given number of months. For more information about the
date_format
, see DateFormatICU.
extra.dateAddYears(date_format, date, years_to_add)
Increments a date by a given number of years. For more information about the
date_format
, see DateFormatICU.
extra.dateDiff(date_format1, date1, date_format2, date2)
Computes the difference between two dates. For more information, see DateDiffICU.
extra.createGuid(0)
Generates a GUID identifier. For more information, see CreateGuid. You must supply a parameter value such as 0.
extra.upper(text)
,
extra.lower(text)
,
extra.capitalize(text)
Changes the text to all upper case, all lower case, or only the first letter capitalized. For more information, see ChangeCase
extra.rtl2ltr(text)
Reverses a string written in a right-to-left language to left-to-right. For more information, see hebrewBidi.
extra.trim(text)
Deletes leading and trailing space characters from the text. For more information, see RemoveMarginSpace.


Updated September 26, 2018