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. Using the IntelliScript Editor
  7. XMap
  8. Libraries
  9. Schema Object
  10. Command Line Interface
  11. Scripts
  12. Parsers
  13. Script Ports
  14. Document Processors
  15. Formats
  16. Data Holders
  17. Anchors
  18. Transformers
  19. Actions
  20. Serializers
  21. Mappers
  22. Locators, Keys, and Indexing
  23. Streamers
  24. Validators, Notifications, and Failure Handling
  25. Validation Rules
  26. Custom Script Components

User Guide

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.

0 COMMENTS

We’d like to hear from you!