String

The value derived from the function is a string.

This table shows the commands and the related syntax used for the String data type.

Command Syntax Examples
Substring

The Substring command returns a part of a string.

SUBSTRING(<input string>;starting position;length)
<input string>: string

Starting position (integer): Determines the position from where the substring starts.

Length(integer): determines the number of subsequent characters that must be included in the substring.

Length does not required to be specified. If length is not specified, the remaining characters initiating from the Starting position are returned.

SUBSTRING("abcdefghijklmnopqrst";3;7)="cdefghi"
SUBSTRING("abcdefghijklmnopqrst";8)="hijklmnopqrst"
SUBSTRING(~;1;10)=first 10 characters of the string that is read in (~="abcdefghijklmnopqrst"=> result="abcdefghij") 
Length

The Length command returns the length of a string.

LENGTH(<input string>)
<input string>: string
LENGTH(abcdefghijklmnopqrst)=20

Can be used in combination with the previous command to remove some characters at the end of a string:

SUBSTRING(~;1;LENGTH(~)-3)

The command returns the entire string that has been read, except the last three characters.

~=abcdefghijklmnopqrst; LENGTH(~)=20; LENGTH(~)-3=17; result=abcdefghijklmnopq
String

The String command converts the input into a string. This can be used if the input requires to be manipulated first and converted into a string afterwards.

STRING(<input>;filter)

<input>: a value

Filter: A string that determines the layout of the conversion to string.

Filter is optional.

STRING(1213;"####0.00")="1213.00"
STRING(1213;"000000.00")="001213.00"STRING(1213)="1213" 

These functions can be used in expressions to read in a string representation of an integer value that is required to be manipulated.

STRING(~+1)
This considers the value of the input, add one (1), and convert the value into a string.
STRING(~;"########0.00")

This would take the value of the input and turn it into a string with a specific layout.

Decode

The Decode function is a way to interpret the string value read in and provides a predefined result. This can be useful if the value read in is a value within a small range, however the value read in has a different representation than the value in Infor Production Scheduling. For example, a status that is read in as 1, 2, 3, 4, 5; however this must be NO STATUS, LOCKED.

DECODE(~;<IN1>;<OUT1>;...;<DEFAULT>)

<IN1>,<IN2>,...: String on input

<OUT1>,<OUT2>,...: the alternative you require the string to be

<DEFAULT>: String representing the default value to be considered if the value read in is not in the <IN> parameters.

This function can consider 25 parameters which results to 12 couples <IN>;<OUT> or 11 couples <IN>;<OUT> and a default value.

The function is interpreted as follows:

CASE OF
~=<IN1> return <OUT1>
~=<IN2> return <OUT2> 
ELSE
 IF <DEFAULT> AVAILABLE
Return <DEFAULT>
ELSE
Return <EMPTY STRING>
END IF
END CASE
DECODE(~;"1";"A";"2";"B";"C")

This returns A if the value read in is 1, B if the value read in is 2 and C in all other cases (as C is the default).