Pre-Defined Functions

In this section:

Transformer provides numerous predefined functions in the following major categories:

To find more information about a function or its parameters, navigate to an appropriate function category within this section. Functions and categories are arranged in alphabetical order.


Top of page

x
EDI Functions

The EDI functions available in Transformer are explained in the following table:

EDI Function

Description

@COUNT_GROUP()

Returns the occurrences of the group within an EDI message.

Parameters: None.

@COUNT_SEGMENT()

Returns the occurrences of the segment within a transaction set.

Parameters: None.

@COUNT_SEGMENT

(Param1)

Returns the occurrences of the specified segment within a transaction set.

Parameter: Param1: Name of the segment and must be a constant.

@COUNT_TRANSACTION()

Returns the occurrences of the transaction within a group.

Parameters: None.

@CRC16()

This function is specific to the UCS 4010 894 document. It is used on the 866 element (CRC 16 checksum) of the G8501 segment. The value of this function is generated using a Cyclic Redundancy Code (CRC) algorithm. It has a fixed length of four characters with no Zero suppression. It applies to the contents of the entire transaction that is configured to segments ST through G86(inclusive).

@LINE_COUNTER

(Param1)

Returns the occurrences of the specified segment within the same loop instance. The counter is reset when a new loop starts.

Parameter: Param1: Name of the segment and must be a constant. It is based on the LN segment description.

Note: Format-specific functions, such as EDI, do not appear in the Functions pane of the Output Node Mapping Builder unless your output is using the exact format.



x
Numerical Functions

The numerical functions available in Transformer are explained in the following table:

Numerical Function

Description

@ADD

(Param1, Param2)

Returns the result of adding two numbers specified as parameters.

Parameters:

Param1: Number to add to Param2.

Param2: Number to add to Param1.

Example: @ADD(24.01, 12.02) returns 36.03.

@AVERAGE

(Param1)

Returns the average of the specified parameter values within the same parent instance. This function is used within the group in combination with the Agg looping property.

Parameter: Param1: Number that represents the value to average. Usually, it is mapped from the ancestor node to the input document node.

Note: The looping settings of the parent and grandparent of the attribute or element that uses the @AVERAGE function must be carefully set. For more information, see Group Properties.

 

Example:

In the following sample, the output node ValueAverage has the value @AVERAGE(Sales/Company/Year/Quarter/Product/Item@value).

where the output obtained is:

<Sales_Totals>
  <companyName>Video and Sound Card 
Express</companyName>
  <Statistics>
     <itemValueAverage>139.7407</itemValueAverage>
     <allTimeSales>95022.02</allTimeSales>
  </Statistics>
</Sales_Totals>

In this XML to XML transformation example, the Sales_Totals output group has looping property set to False and the Statistics group has looping property set to Agg. The desired output value is also obtained with Sales_Totals looping property set to Agg, but not when it is set to True.

@CHKNUM

(Param1)

Returns the true string if the specified parameter is a valid number. Use this function to ascertain if the parameter is a number (either integer whole or decimal). Returns true or false.

Parameter: Param1: Number to validate.

Examples:

@CHKNUM('1.1') returns true.

@CHKNUM('abcd') or @CHKNUM('1,234.55') returns false.

@COUNT

Counts the input items processed and returns the next value sequentially. The first loop through @COUNT initializes the counter to 1. Subsequent passes increment the count to the next number integer.

Parameters: None.

@DIVIDE

(Param1, Param2)

Returns the decimal result of dividing two numbers specified as parameters.

Parameters:

Param1: Number that represents the dividend.

Param2: Number that represents the divisor.

Example: @DIVIDE('24.02', '12.01') returns 2.0.

@INT

(Param1)

Returns the first occurrence of the integer value found in the specified parameter. If the integer cannot be found, the number 0 (zero) is returned.

Parameter: Param1: String to be checked.

Examples:

@INT('45.60 or 65.60') returns 45.

@INT('in the summer of 1998 and 1999') returns 1998.

@INT('time is 23:11:56') returns 23.

@INT('last year') returns 0.

@INTVAL

(Param1)

Returns the specified parameter value if it is a valid integer. Otherwise, it returns the number 0 (zero).

Parameter: Param1: String to be checked.

Examples:

@INTVAL('45') returns 45.

@INTVAL('45.12') or @INTVAL('dollars 1.23') returns 0.

@MULTIPLY

(Param1, Param2)

Returns the decimal result of multiplying two members specified as parameters.

Parameters:

Param1: Number to multiply by Param2.

Param2: Number to multiply by Param1.

Example: @MULT (12.01, 2.00) returns 24.02.

@NUM

(Param1)

Converts an integer string to a numeric value. Use this function to ascertain if a parameter is an integer (whole number). The function returns the parameter or an error.

Parameter: Param1: Numeric string to be converted to an integer value.

Example: @NUM('45') returns 45.

@NUM_CHR

(Param1)

Returns the ASCII character that corresponds to a number.

Parameter: Param1: Integer number between 1 and 127 to represent the order of an ASCII character.

Example: @NUM_CHR ('66') returns 'B'.

@RANDOM

(Param1)

Returns a pseudo random number.

Parameter: Param1: Number used to seed the random number generator.

If Param1 = -1, the seed is initialized randomly.

If Param1 = n (where n is not 0 or -1), the seed is initialized to n.

If Param1 = 0, the same random number value that is generated for the previous output item will be used as the result for the next output item.

For example, if an output element's @RANDOM value was '-12345' and you use @RANDOM('0') for the next element, the same '-12345' value is also returned for this element.

@RANGE

(Param1, Param2, Param3)

Checks if a number falls within a range and returns the string value of “true” or ”false.”

Parameters:

Param1: Value is checked.

Param2: Value that represents the lower limit of the range.

Param3: Value that represents the upper limit of the range.

Note: The range is given by Param2 to Param3, inclusive.

Example: @RANGE('10', '5', '15') evaluates to true.

@ROUND

(Param1,Param2, Param3)

Extracts a specified part of a number and rounds the result to an integer.

Parameters:

Param1: Number subjected to the operation.

Param2: Number of digits to be extracted from the integer part of Param1. Digits are counted from the left of the decimal separator.

Param3: Number of digits to be extracted from the decimal part of Param1. Digits are counted from the right of the decimal separator.

Example: @ROUND(345.995, 2, 2) returns 46.00.

@SCALE_ROUND

(Param1, Param2, Param3)

Returns the specified parameter rounded in a specified fashion. Enables you to scale a number and specify the way it is rounded during scaling.

Parameters:

Param1: Number subjected to the operation.

Param2: Number of digits to the right of the decimal place to keep. The value must be a non-negative integer.

Param3: Type of rounding required.

The following are possible values:

ROUND_CEILING: Round towards positive infinity.

ROUND_DOWN: Round towards zero.

ROUND_FLOOR: Round towards negative infinity.

ROUND_HALF_DOWN: Round towards nearest number. If equidistant to two numbers, round down.

ROUND_HALF_EVEN: Round towards nearest number. If equidistant to two numbers, round towards even number.

ROUND_HALF_UP: Round towards nearest number. If equidistant to two numbers, round up.

ROUND_UNNECESSARY: No rounding is necessary. Use this rounding mode if you want to make sure that the output value has the exact number of decimals specified in Param2. If the number of decimals is different, an error is returned.

ROUND_UP: Round away from zero.

Example: @SCALE_ROUND(5.111, 2, ROUND_UP) returns 5.12.

@STR

(Param1, Param2)

Converts a number to an alpha string according to a picture mask. Use this function to format numbers.

Parameters:

Param1: Number to be converted into an alpha string.

Param2: Picture mask format for the string. For more information, see Numeric Pictures.

Examples: @STR('45.12', '##.#') returns '45.1'.

@STR('75','#.00') returns 75.00.

@STR('567.1', '#.00') returns 567.10.

Note: Since a picture mask is used, the function may cause rounding, for example, @STR(39.999,'#.00') returns '40.00'.

@SUBTRACT

(Param1, Param2)

Returns the result of subtracting two numbers specified as parameters.

Parameters:

Param1: Float number from which to subtract Param2.

Param2: Float number to subtract from Param1.

Example: @SUBTRACT(24.02, 11.01) returns 13.01.

@SUM

(Param1)

Returns the sum of the numeric values of a specified input node.

Parameter: Param1: Input node that has a numeric value.

Note: The looping settings of the parent and grandparent of the node that uses the @SUM function must be carefully set. For more information, see Group Properties.

Example: In the following sample, the output node allTimeSales has value @SUM(@MULTIPLY(Sales/Company/Year/Quarter/Product/Item @value, Sales/Company/Year/Quarter/Product/Item@sold)).

Where the output obtained is:

<Sales_Totals>
<companyName>Video and Sound Card 
Express</companyName>
  <Statistics>
     <itemValueAverage>139.7407</itemValueAverage>
     <allTimeSales>95022.02</allTimeSales>
  </Statistics>
</Sales_Totals>

In this XML to XML transformation example, the Sales_Totals output group has looping property set to False and the Statistics group has looping property set to Agg. The desired output value is also obtained with Sales_Totals looping property set to Agg, but not when it is set to True.

@VAL

(Param1, Param2)

Returns the number that matches the specified picture mask. This function returns a value only if the picture mask matches the input format. For example, if the picture mask is # and the input is 7.3, the function returns an error, not 7 as might be expected.

Use this function to retrieve the numeric value from a string.

Do not use this function to format a number. To format a number, use the @STR function.

Parameters:

Param1: String that contains the number to be retrieved.

Param2: Format in which the number is stored in the string; must be specified as a constant in the Mapping Builder. For more information, see Numeric Pictures.

Examples:

@VAL('30.11 dollars plus a fee of 40 dollars','##') returns 40.

@VAL('30.11 dollars plus a fee of 40 dollars','##.##') returns 30.11.

Note: If you need to format a number with commas such as <X>123,456,789</X>, you can remove commas by using the @CONCAT and @SUBSTR functions. For example:

@CONCAT(@SUBSTR(X,'1','3'),@SUBSTR(X,'5','3'),@SUBSTR(X,'9','3'))



x
Processing Functions

The processing functions available in Transformer are explained in the following table:

Processing Function

Description

@EDIT

(Param1, Param2, Param3)

Returns a value formatted using the specified picture mask and formatter class name. For more information, see Numeric Pictures.

Parameters:

Param1: String representing the formatter class name. Current implementation has support only for the DecimalFormat class.

Param2: String representing the picture mask to be applied to Param3.

Param3: Number to be formatted.

Examples:

@EDIT('DecimalFormat','#,###.##','123456.78) returns 123,456.78.

@EDIT('DecimalFormat','000','12') returns 012.

@EXISTS

(context_to_be_checked)

Returns a string with a Boolean value that represents whether the context is null or not.

This processing function can be used to distinguish between an element that is missing from a document structure from an element that is present, but has a value of an empty string.

Examples:

<Statistics>
   <itemValueAverage>139.7407</itemValueAverage>
   <allTimeSales>95022.02</allTimeSales>
</Statistics>

@EXISTS (Statistics/ itemValueAverage) returns true

<Statistics>
   <itemValueAverage></itemValueAverage>
   <allTimeSales>95022.02</allTimeSales>
</Statistics>

@EXISTS (Statistics/ itemValueAverage) returns true

<Statistics>
   <allTimeSales>95022.02</allTimeSales>
</Statistics>

@EXISTS(Statistics/ itemValueAverage) returns false

@GETCONSTANT

(Param1)

Returns the value of the global constant specified by name as the parameter.

Parameter: Param1: Global constant defined in the Global Constant section of the Project Properties pane.

Example: Assume you defined the following global constant in project properties:

Name: COMPANY_ADDRESS Value: 1234 1st Avenue.

@GETCONSTANT('COMPANY_ADDRESS') returns '1234 1st Avenue'.

@IF

(Param1,Param2, Param3,Param4, Param5)

Allows for conditional selection statement defined by the first three parameters. If the condition evaluates as true, it returns the fourth Parameter contents. Otherwise, it returns the fifth Parameter contents.

Parameters:

Param1: Left operand of the condition statement.

Param2: Conditional operator; the possible arguments are:

  • = = equal to
  • != not equal to
  • >= equal to or greater than
  • <= equal to or less than
  • > greater than
  • < less than

Param3: Right operand of the condition statement.

Param4: (true_option). The string to be returned if the condition statement is true.

Param5: (false_option). The string to be returned if the condition statement is false.

Example: The variable X has a value that fluctuates between 4 and 8. @IF(X<'10', 'ABC', 'DEF') always returns 'ABC'.

@INPUT_CONTENT

Returns the contents of the entire input data file as a string.

Parameters: None.

@JDBCLOOKUP

(Param1, Param2)

Returns a value retrieved from a database using an SQL statement. The SQL statement can be dynamically based on the input from other transform functions. If more than one value is retrieved by the SQL statement, then the last value is returned in the sequence.

Parameters:

Param1: String that represents the name of a globally defined JDBC connection configuration.

Param2: SQL statement that is defined using SQL Builder.

Example:

@JDBCLOOKUP('LOOKUP_TEST', {'SELECT field1
FROM LOOKUP_TABLE WHERE field2 ' = '+@QUOTE(Customer/Person/Name)})

where:

LOOKUP_TEST

Is the name of the specific JDBC connection configuration.

{'SELECT field1 FROM LOOKUP_TABLE WHERE field2 ' = '+@QUOTE(Customer/Person/Name)}

Is the SQL statement that is constructed dynamically.

@NULL

Returns a null output, that is, no output. Useful, for example, as either the true_option or false_option in an @IF function.

Parameters: None.

@REPLACE

(Param1, Param2)

Calls the pre-defined replace function specified by name in the second parameter of @REPLACE, which will replace every matched string specified in the first parameter. If the match is not found, the first parameter is returned. For more information on how to define replace functions, see Using the Output Node Mapping Builder.

Parameters:

Param1: Input node, value, or constant into which to make changes.

Param2: Replace function’s name as defined.

Example: @REPLACE('11009333009', 'REPLACE_009_WITH_Add') returns 11Add333Add.

Note: The @REPLACE processing function supports spaces and unprintable characters (for example, \t, \r, or \n) as parameter values.

@SIMPLE_REPLACE

(Param1, Param2)

Calls the pre-defined replace functions, which replaces the first string that is matching the value of the first parameter of this function. If the match is not found, the first parameter is returned.

Parameters:

Param1: Input node value into which to make changes.

Param2: Replace function name as defined.

Example: @SIMPLE_REPLACE('009', 'REPLACE_009_WITH_Add') returns Add.



x
Run-time Functions

The run-time functions available in Transformer are explained in the following table:

Run-time Function

Description

@IWENCR

(Param1)

Returns the encrypted value of the parameter based on the iWay Service Manager internal encryptor.

Parameter: Param1: String to be encrypted.

Example:

@IWENCR('1234') returns the value in a format similar to:

@ENCR(32533101323532123122319631833137).

@SREG

(Param1, Param2)

Returns some of iWay Service Manager’s special registers defined by the specified parameter. This functionality is supported for run-time purposes only. If the function is tested in design time, Param2 is always returned.

Parameters:

Param1: String that represents the name of the special register which value is to be returned.

Param2: String that represents the default value to return if the special register identified by Param1 is not found.

Note: The second parameter of the @SREG() function must consist of a mapped dynamic value. A static default value as the second parameter is not allowed. When troubleshooting @SREG() evaluation problems, it is recommended to map a dynamic value to the second parameter instead of using a static default value.

@SET_SREG

(Param1, Param2, Param3, Param4)

Sets the specified iWay Service Manager special register to the specified value and returns Param4. This functionality is supported for run-time purposes only.

The special register’s name is specified in Param1, the value to be assigned is specified in Param2, the type of the special register is specified in Param3, and Param4 contains the value to be returned upon successful execution.

Parameters:

Param1: String that represents the name of the special register.

Param2: String that represents the new value of the special register.

Param3: Number that represents type of the special register. Possible values include:

  • 2: user-defined variable
  • 3: user-defined emit header

Param4: String that represents the expected return value of this function.

Example: @SET_SREG ('custom_functions_location', 'tools/transformer/custom_functions','2','custom functions location is set') returns 'custom function location is set'.

@SREG_EXISTS

(Param1)

Checks if an iWay Service Manager special register with the name specified in the Parameter is already defined and returns a true or false response. This functionality is supported for run-time purposes only.

Parameters:

Param1: String that represents the name of the special register.

Example: @SREG_EXISTS('custom_functions_location')

Returns true if the register was already defined. Returns 'false' if the register was not defined.

@REMOVE_SREG

(Param1, Param2)

Removes iWay Service Manager special register with the name specified in Parameter and returns Param2. This functionality is supported for run-time purposes only.

Parameters:

Param1: String that represents the name of the special register.

Param2: String that represents the expected return value of this function.

Example: @REMOVE_SREG ('custom_functions_location','custom functions location is removed')

Returns 'custom function location is removed'.



x
Security Functions

The security functions available in Transformer are explained in the following table:

Security Function

Description

@CHKDGT

(Param1, Param2)

Checks that at the specified position of string in Param1, alphanumeric character is a number or a letter and returns 'true' if it is a number or 'false' if it is a letter.

Parameters:

Param1: Alpha string that represents the number to be checked.

Param2: Position of the character in Param1 to check. The position numbering starts at 0 (zero) from the left. Enter as a constant in the Mapping Builder.

Examples:

@CHKDGT('4abc', '0') returns 'true'.

@CHKDGT('6a89', '1') returns 'false'.



x
String Functions

The string functions available in Transformer are explained in the following table:

String Function

Description

@CONCAT

(Param1, Param2, Param3, Param4)

Returns the string of concatenations of the specified parameters.

If required, you can add or remove parameters for the @CONCAT function using the Output Node Mapping Builder. For more information, see Customizing @CONCAT Functions.

The following signatures of the @CONCAT function are available:

@CONCAT(Param1, Param2)

@CONCAT(Param1, Param2, Param3)

@CONCAT(Param1, Param2, Param3, Param4)

Parameters:

Param1: String to be concatenated.

Param2: String to be concatenated.

Param3: String to be concatenated.

Param4: String to be concatenated.

Example: @CONCAT('The cow ', 'jumped ', ' over ', ' the moon') returns 'The cow jumped over the moon'.

@CRLF

Returns the combination of the Carriage Return and new Line Feed characters.

Parameters: None.

Example: @CONCAT('First line',@CRLF(),'Second line')

returns 'First line

Second line'.

@DELSTR

(Param1, Param2, Param3)

Deletes the characters substring from an alpha string for the length specified in Param3.

Parameters:

Param1: Alpha string or alpha string expression.

Param2: Position of the first character to be deleted.

Param3: Number of characters to be deleted, beginning with Param2 and continuing to the right.

Examples:

@DELSTR('ABCD', '2', '1') deletes the second letter of the string and returns 'ACD'.

@IF(Y<0, @DELSTR(X, '1', '1'), @IF(Y>0, @DELSTR(X, '2', '1'), X)).

If X contains a character string of length greater than or equal to 2, the expression removes either the first or second character, or leaves the string intact, depending on the value that appears in column Y (negative, positive, or zero).

@EQUALS

(Param1, Param2)

Compares two strings and returns 'true' if they are equal or 'false' if they are not.

Parameters:

Param1: String to compare.

Param2: String to compare.

Example: @EQUALS('BA', 'AB') return 'false'.

@FILL

(Param1, Param2)

Repeats an alpha string or expression multiple times.

Parameters:

Param1: An alpha string or expression.

Param2: The number of times the string is repeated.

Example: @FILL('*',5) creates a string of five asterisks '*****'.

Note: This function accepts a maximum of 32K.

@FLIP

(Param1)

Reverses an alpha string, or the result of an alpha expression, to its mirrored image.

Parameter: Param1: Alpha string or alpha string expression.

Example: @FLIP('Good') returns 'dooG'.

@HSTR

(Param1)

Returns the hexadecimal (base 16) string value of a decimal (base 10) number specified as Param1.

@HSTR

Parameter: Param1: Decimal (base 10) number or numeric expression that represents a decimal number.

Example: @HSTR('15') returns 'F'. @HSTR('16') returns '10'.

@HVAL

(Param1)

Returns the decimal (base 10) value of a hexadecimal (base 16) number specified as Param1.

Parameter: Param1: Alpha string that represents a hexadecimal (base 16) number.

Example: @HVAL('FF') returns 255. @HVAL('10') returns 16.

@INSERT

(Param1, Param2, Param3, Param4)

Inserts one string into another at the specified position.

Parameters:

Param1: Alpha string that represents the target string.

Param2: Alpha string that represents the source string.

Param3: Number that represents the character position in Param1, after which the insertion will take place.

Param4: Number that represents the number of characters from Param2 to be inserted into Param1.

Example: @INSERT('abcde', 'xxx', '3', '2') returns 'abcxxde'.

@INSTR

(Param1, Param2)

Returns an integer that represents the first position of a substring within an alpha string or alpha expression.

Parameters:

Param1: Input string or alpha expression string.

Param2: Alpha string that will be searched for in the input string.

Examples:

@INSTR('abcd', 'b') returns 2.

@INSTR('ABCDEF', 'DE') returns 4.

Note: If the search argument is not found, the function returns 0 (zero).

@LEFT

(Param1, Param2)

Returns a substring of an alpha string, starting from the left, with its length specified in Param2.

Parameters:

Param1: Input string.

Param2: Number of characters to be returned, starting from the left.

Example: @LEFT('abcdefg', '3') returns 'abc'.

@LEN

(Param1)

Returns an integer number which equals to the length of an alpha string.

Parameter: Param1: Input string.

Example: @LEN ('abcdefg') returns 7.

Note: The string is right-justified (for example, trailing blanks are removed) before commencing.

@LOWER

(Param1)

Returns a string converted to all lowercase letters.

Parameter: Param1: Input string.

Example: @LOWER('Who said THAT?') returns 'who said that?'

@LPAD

(Param1, Param2)

Returns the specified input string padded to the left using the string specified in Param1. The padding is inserted to the left of the string input until the length specified in Param2 is reached. If padding is not performed (in case of either invalid parameters or the desired length being smaller than the length of the input string) the first parameter (Param1) is returned.

Parameters:

Param1: String input to be padded.

Param2: Number that represents the desired length of the returned string.

Examples:

Single quotation marks are not part of the data; they are used to visually mark the length of the padded string.

@LPAD('constant','12') returns '            constant'.
@LPAD('constant','3') returns '   constant'.

@LPAD

(Param1, Param2, Param3)

Returns the specified input string padded to the left using the string specified in Param3. The string is inserted to the left of the input string until the desired length specified in Param2 is reached. If padding is not performed (in case of either invalid parameters or the desired length being smaller than the length of the input string) the first parameter is returned.

Parameters:

Param1: Input string to be padded.

Param2: Number that represents the length of the returned string.

Param3: String used for padding.

Examples:

Single quotation marks are not part of the data; they are used to visually mark the length of the padded string.

@LPAD('constant','12', 'L') returns 'LLLLLLLLLLLLconstant'.

@LPAD('constant','3', 'L') returns 'LLLconstant'.

@LTRIM

(Param1)

Removes white space characters from the left side of a string (such as blanks, tabs, line feeds).

Parameter: Param1: Input string.

Example: @LTRIM(' John') returns 'John'.

@MID

(Param1, Param2, Param3)

Returns the substring extract of the specified number of characters from an input string.

Note: Will be deprecated in future releases. Use @SUBSTR.

Parameters:

Param1: Input string.

Param2: Number that represents the starting position of the substring within Param1.

Param3: Number of characters to be extracted (length of the substring).

Example: @MID('John', '3', '2') returns 'hn'.

@NOT_EQUALS

(Param1, Param2)

Compares two strings in Param1 and Param2 and returns 'false' if they are equal or 'true' if they are not.

Parameters:

Param1: String.

Param2: String.

Example: @EQUALS('BA', 'AB') return 'true'.

@QUOTE

(Param1)

Returns the specified parameter in Param1 delineated by the single quotation marks.

Parameter:

Param1: String to be quoted.

Examples:

@QUOTE('quote me') returns 'quote me'.

@QUOTE('23') returns '23'.

@QUOTEGEN

(Param1)

Generates 'Where' clause SQL statements. Generates single quotation marks around an alpha string, but not if the input is an integer or a number.

Parameter:

Param1: String; can be an input node value, a constant, or the result of another function.

Examples:

@QUOTEGEN('HELLO') returns 'HELLO'.

@QUOTEGEN('1234') returns 1234.

@CONCAT('SELECT column1 from table where column2 = ', @QUOTEGEN(parent/child/value))

returns:

  • “SELECT column1 from table where column2 = 'value', IF parent/child/value type is an alpha string.”
  • “SELECT column1 from table where column2 = value, IF parent/child/value type is integer or number.”

@REP

(Param1, Param2, Param3, Param4)

Returns the result of replacement of an alpha substring in an input string with another substring.

Parameters:

Param1: Input alpha string or expression where the replacement will take place.

Param2: Alpha string or expression that provides the substring to copy to Param1.

Param3: First position in Param1 that receives the substring from Param2.

Param4: Number of characters that are moved from Param2 to Param1, starting from the left most character of Param2.

Example: @REP('12345', 'abcde', '3', '2') returns '12ab5'.

@RIGHT

(Param1, Param2)

Returns a substring of an alpha string, starting from the right, with its length specified in Param2.

Parameters:

Param1: Input string from which the characters are taken.

Param2: Number of characters to be retrieved, starting from the character furthest right.

Example: @RIGHT('abcdefg ', '3') returns 'efg'.

@RPAD

(Param1, Param2)

Returns the specified input string padded to the right using the string specified in Param1. The padding is inserted to the right of the input string until the desired length specified in Param2 is reached. If padding is not performed (in case of either invalid parameters or the desired length being smaller than the length of the input string) the first parameter is returned.

Parameters:

Param1: String to be padded.

Param2: Number that represents the length of the returned string.

Examples:

Single quotation marks are not part of the data: they are used to visually mark the length of the padded string.

@RPAD ('constant','12') returns 'constant            '.
@RPAD ('constant','3') returns 'constant   '.

@RPAD

(Param1, Param2, Param3)

Returns the specified input string padded to the right using the string specified in Param3. The at string is inserted to the right of the input string until the desired length specified in Param2 is reached. If padding is not performed (in case of either invalid parameters or the desired length being smaller than the length of the input string) the first parameter is returned.

Parameters:

Param1: String to be padded.

Param2: Number that represents the length of the returned string.

Param3: String used for padding.

Examples:

Single quotation marks are not part of the data; they are used to visually mark the length of the padded string.

@RPAD ('constant','12', 'R') returns 'constantRRRRRRRRRRRR'.

@RPAD ('constant','3', 'R') returns 'constantRRR'.

@RTRIM

(Param1)

Removes white space characters from the right side of a string (such as blanks, tabs, line feeds).

Parameter: Param1: Input alpha string.

Example: @RTRIM('John ') returns 'John'.

@STRTOKEN

(Param1, Param2, Param3)

Returns a specified string token from a delimited token string.

Parameters:

Param1: Input string, delimited with tokens.

Param2: Requested token index (numeric).

Param3: Delimiter (can be an <XML> keyword).

Parameter Notes:

  • Param3 can have more than one character as the delimiter.
  • An empty string is returned when a delimiter is not found, is empty, or if the input string is empty.
  • Every delimiter is counted for the index calculation (no repetition).

Example: variable BA = abcd,cdef,ghik,lmnp, then @STRTOKEN(BA, '2', ',') returns cdef.

Note: You can use valid <XML> element tags (nodes) as delimiters. The XML format of a list can be a variable or URL. Content must consist of a <list><tag>Value</tag></list> set, where element names can be arbitrary but must be consistent.

@SUBSTR

(Param1, Param2, Param3)

Returns the substring representing the extracts of a specified number of characters from an alpha string.

Parameters:

Param1: Input alpha string.

Param2: Number that represents the starting position of the substring within Param1.

Param3: Number of characters to be extracted (length of substring).

Example: @SUBSTR('John', '3', '2') returns 'hn'.

@TRIM

(Param1)

Removes white space characters from the left and right sides of a string (such as blanks, tabs, line feeds).

Parameter: Param1: Input alpha string.

Example: @TRIM(' John ') returns 'John'.

@UPPER

(Param1)

Returns a string converted to all uppercase letters.

Parameter: Param1: Alpha string.

Example: @UPPER('Pablo Picasso') returns 'PABLO PICASSO'.



x
Time Functions

The time functions available in Transformer are explained in the following table:

Time Function

Description

@ADD_DATE

(Param1, Param2, Param3, Param4)

Performs a calculation on a date variable. Constructs a resulting date out of an input date and 3 values added to that date: years, months, and days. The result is always of the valid date format.

Parameters:

Param1: Input Date (Format: MM/dd/yyyy).

Param2: Number of years to add to Param1.

Param3: Number of months to add to Param1.

Param4: Number of days to add to Param1.

Example: @ADD_DATE('01/01/1992', '1', '2', '2') returns 03/03/1993.

Note: Zero values of the parameters are ignored.

@ADD_TIME

(Param1, Param2, Param3, Param4)

Performs a calculation on a time variable. It constructs a time out of an input time parameter and three other parameters to be added to it as hours, minutes, and seconds. The result is always of the valid time format.

Parameters:

Param1: Input Time value.

Param2: Number of hours to add to Param1.

Param3: Number of minutes to add to Param1.

Param4: Number of seconds to add to Param1.

Example: @ADD_TIME('12:00:00', '1', '2', '3') returns 13:02:03.

Note: Zero values of the parameters are ignored.

@CUSTOMDATE()

Will be deprecated in future releases. Use @DATE.

@DATE

(Param1)

Returns the system date value in the specified format. For more information, see Date Pictures.

Parameter: Param1: Date format.

Example: If the system date is 01/28/1992, @DATE ('dd/MM/yyyy') returns '28/01/1992'.

@DAY

(Param1)

Returns the day value of the specified date (a number between 1 and 31).

Parameter: Input date value: Date or date expression.

Example: @DAY('01/28/1992') returns '28'.

@DOW

(Param1)

Returns the number of the day of the week for the specified date, where Sunday is 1, Monday is 2, and so on.

Parameter: Input date value: (Format: MM/dd/yyyy).

Example: @DOW('01/29/1992') (representing a Wednesday) returns '4'.

@DSTR

(Param1, Param2)

Returns the specified date in the format specified by the second parameter. The original input must be in the format: 'MM/dd/yyyy'. For more information, see Date Pictures.

Parameters:

Param1: Input date value (Format: MM/dd/yyyy.)

Param2: The picture mask (format) of the returned date string.

Example: @DSTR('2/12/1998','MMMM dd, yyyy') returns 'February 12, 1998'.

@DSTR

(Param1, Param2, Param3)

Returns an input value date format according to the third parameter value. The input date value must conform to the format specified by the second parameter. For more information, see Date Pictures.

Parameters:

Param1: Input date value.

Param2: The picture mask of the input date value.

Param3: The picture mask (format) of the returned date string.

Example: @DSTR('2/12/1998','dd/MM/yyyy','MMMM dd, yyyy') returns 'December 02, 1998'.

@DSTR

(Param1, Param2, Param3, Param4)

Returns an input value date format according to the fourth parameter, which accepts a boolean value (true or false).

Parameters:

Param1: Input date value.

Param2: The picture mask of the input date value.

Param3: The picture mask (format) of the returned date string.

Param4: Determines whether or not the input date value will comply with standard formatting requirements.

@DVAL

(Param1, Param2)

Converts an input value date to a numeric value. The numeric value represents the number of days elapsed since the day before the first day of the 1st century (01/01/01) until the input date. For more information, see Date Pictures.

Parameters:

Param1: Input date value string that can be interpreted as a date (for example, '01/01/92', 'Jan 1, 1992').

Param2: The format of the input date; this parameter is required for the system to read and interpret Param1.

Example: @DVAL('01/01/92', 'MM/dd/yy') and @DVAL('Jan 1, 1992', 'MMM dd, yyyy') each return 727198.

@EOM

(Param1)

Returns the date of the end of the month specified in the parameter.

Parameter: Param1: Input date value.

Example: @EOM ('05/05/93') returns 05/31/93.

@EOY

(Param1)

Returns the date of the end of the year specified in the parameter.

Parameter: Param1: Input date value.

Example: @EOY ('10/05/93') returns '12/31/93'.

@GD2JD

(Param1, Param2)

Converts a date in Gregorian format to the Julian date format.

The Gregorian date format, which is based on the Gregorian solar calendar, is the most widely used date format in the world. A Gregorian date is specified by the Year, the Month (identified by name or number), and the Day of the Month (numbered sequentially starting at 1). For example, 2008-03-25 is a Gregorian date representation for March 25, 2008.

In J.D. Edwards systems, Julian dates (JD) are identified by the year first, followed by the number of days into the year that this date appears. For example, Jan 15, 1999 would be represented as 99015. March 15 would be 99074. March 15, 2001 would be 101074, since dates in the current century start with 100 (2000), 101 (2001), and so on.

Parameters:

Param1: Gregorian date

Param2: Gregorian date picture mask

@HOUR

(Param1)

Returns a number that represents the hour portion of the input time value.

Parameter: The input time value.

Example: @HOUR('2:00:00') returns 2.

@JD2GD

(Param1, Param2)

Converts a date in Julian format to the Gregorian date format.

In J.D. Edwards systems, Julian dates (JD) are identified by the year first, followed by the number of days into the year that this date appears. For example, Jan 15, 1999 would be represented as 99015. March 15 would be 99074. March 15, 2001 would be 101074, since dates in the current century start with 100 (2000), 101 (2001), and so on.

The Gregorian date format, which is based on the Gregorian solar calendar, is the most widely used date format in the world. A Gregorian date is specified by the Year, the Month (identified by name or number), and the Day of the Month (numbered sequentially starting at 1). For example, 2008-03-25 is a Gregorian date representation for March 25, 2008.

Parameters:

Param1: Julian date

Param2: Gregorian date picture mask

@MINUTE

(Param1)

Returns a number that represents the minutes portion of the input time value.

Parameter: The input time value.

Example: @MINUTE('2:35:00') returns 35.

@MONTH

(Param1)

Returns a number that represents the month portion of the input time value.

Parameter: The input time value.

Example: @MONTH('01/28/1992') returns 1.

@SECOND

(Param1)

Returns a number that represents the seconds portion of the input time value.

Parameter: The input time value.

Example: @SECOND('12:02:05') returns 5.

@SOM

(Param1)

Returns a number that represents the start of the month portion of the input time value.

Parameter: The input time value.

Example: @SOM ('05/18/93') returns '05/01/93'.

@SOY

(Param1)

Returns a number that represents the start of the year portion of the input time value.

Parameter: The input time value.

Example: @SOY ('10/05/93') returns '01/01/93'.

@TIME

(Param1)

Returns the system time. For more information, see Time Pictures.

Parameter: Param1: The desired time format.

Example: @TIME ('HH:mm:ss') returns 17:08:42.

@TSTR

(Param1, Param2)

Converts a time to an alpha string, according to the format provider. For more information, see Time Pictures.

Parameters:

Param1: The desired input time value.

Param2: Format of the resulting character string.

Example: @TSTR ('14:30', 'HH:mm PM') returns '2:30 PM'.

Note: A blank picture interprets the string as 'HH:mm:ss'.

@YEAR

(Param1)

Returns a number that represents the year portion of the input time value.

Parameter: Param1: Date or date expression.

Example: @YEAR('01/28/1992') returns 1992.



x
Numeric Pictures

The numeric picture masks available in Transformer are explained in the following table:

Symbol

Location

Description

0

Number

Digit.

#

Number

Digit, zero shows as absent.

.

Number

Decimal separator or monetary decimal separator.

-

Number

Minus sign.

,

Number

Grouping separator.

E

Number

Separates mantissa and exponent in scientific notation. This does not need to be quoted in the prefix or suffix.

%

Prefix or suffix

Multiply by 100 and show as a percentage.

Examples of numeric picture masks are shown in the following table (the ^ symbol represents one space character).

Numeric Value

Picture

Resulting Numeric Value

1234.56

#,###.##

1,234.56

123456789.56

#,###.##

123,456,789.56

-1234.56

N###,###.##C

^^-1,234.56

-1234.56

N######.##L

-1234.56^^

-1234.56

N######.##P*

-**1234.56

0

N######.##Z*

*********

-13.5

N##.##-DB;

DB13.50

45.3

N##.##+CR;

CR45.30

-13.5

N##.##-(,);

(13.50)

4055.3

$######.##

$^^4055.30



x
Date Pictures

The following table lists and describes the date symbols and shows an example of each.

Symbol

Description

Example

Presentation

G

Era designator

AD

Text

y

Year

1996

Number

M

Month in year

July & 07

Text & Number

d

Day in month

10

Number

E

Day in week

Tuesday

Text

D

Day in year

189

Number

F

Day of week in month

2 (2nd Wed. in July)

Number

w

Week in year

27

Number

W

Week in month

2

Number

'

Escape for text

'

Delimiter

' '

Single quotation mark

'

Literal

-

Separates month, day, and year.

12-24-86

Delimiter

/

Separates month, day, and year.

12/24/86

Delimiter

The typical date formats are 'dd/MM/yyyy' (European), 'MM/dd/yyyy' (American), or 'yyyy/MM/dd' (Scandinavian). When you define the attribute Date for the parameter in one of the functions, you must also select the format for the date item, as described in the following table. You can change the default formats and place in it any positional directives and mask characters you require.

The following table lists examples of the date format, using the date of 21 March 1992 (the ^ symbol represents one space character).

Date Picture

Result and Notes

MM/dd/yyyy

03/21/1992

##/##/##

21/03/92 when an XML parser default is set to European.

03/21/92 when an XML parser is set to American.

MMMM^dd^yyyy

March^21^1992

MMM^dd, ^yyyy

Mar.^21^1992

EEEE^^-^7

Saturday^^^-^7

E^7

Mon^7



x
Time Pictures

The following table lists and describes the time symbols and shows an example of each.

Symbol

Description

Example

Presentation

h

Hour in am/pm (1-12)

12

Number

H

Hour in day (0-23)

0

Number

m

Minute in hour

30

Number

s

Second in minute

55

Number

-

Separates hours from seconds

1-22

1-22

:

Separates hours from seconds

1:22

1:22

S

Millisecond

978

Number

a

AM/PM marker

PM

Text

k

Hour in day (1-24)

24

Number

K

Hour in am/pm (0-11)

0

Number

z

Time zone

Pacific Standard Time

Text

The following table shows examples of time pictures and results.

Time Picture

Result

Comments

HH:mm:SS

08:20:00

Time displayed on 24-hour clock.

HH:mm:SS

16:40:00

Time displayed on 24-hour clock.

HH:mm PM

8:20 pm

Time displayed on 12-hour clock.

HH:mm PM

4:40 pm

Time displayed on 12-hour clock.

HH-mm-SS

16-40-00

Example of time separator of '-'.



x
Customizing @CONCAT Functions

You can customize the signature of your @CONCAT function for a specific output node by adding or removing parameters as required using the Output Node Mapping Builder. This functionality adds flexibility to the design of mapping values, which involve complex string concatenations; it also eliminates the need to use expressions for the concatenation of strings in Transformer.



x
Procedure: How to Add Parameters for @CONCAT Functions

To add parameters for @CONCAT functions:

  1. In the Output Node Mapping Builder, right-click the @CONCAT function in the workspace area.

  2. Select Add Parameter from the context menu.

    The parameter is added to the parameter list, and the number of parameters for this function definition will increase by one.



x
Procedure: How to Remove Parameters for @CONCAT Functions

To remove parameters for @CONCAT functions:

  1. In the Output Node Mapping Builder, right-click a parameter to delete from the @CONCAT function in the workspace area.

  2. Select Remove Parameter from the context menu.

    The parameter is removed from the parameter list, and the number of parameters for this particular function definition will decrease by one.


iWay Software