About Extended Rules
An extended rule consists of a declarations section followed by a statements section.
The declarations section is required only if you use additional variables. The declarations section is where you declare the names and types of any variables you use either in the extended rule
The statements section is where you define the actions that you want the extended rule to run.
You must declare any variables that are not already defined as part of the input or output specification of the map before you use those variables in an extended rule.
For more information, see:
Declarations Section
Variables consist of a name and a data type. Variable names can include alphanumeric characters and the colon (:) and underscore (_) characters. The first character in a variable name cannot be numeric. All variable names are case-sensitive.
The translator does not initialize any variables. After you declare a variable, initialize it to prevent unexpected mapping results.
Supported Data Types
Extended rules support these data types:
- Integer – A whole number with no decimal component
- Real – A whole number with a decimal component
- String – One or more printable characters
- Datetime – A date or time
- Array – A table of multiple
occurrences of a single data type Note: Single-character strings are treated as a String; the “char” datatype is not supported by Sterling B2B Integrator Map Editor extended rules.
Variable Declaration and Initialization Examples
This list contains a sample declaration and initialization of variables of each data type:
- Declare i as an integer and initialize i
integer i;
i = 0;
- Declare r as a real number and initialize r
real r;
r = 0;
- Declare d as a date or time and initialize d
datetime d;
d = date(0,0,0);
- Declare s as a 20-character string and initialize s
string[20] s;
s = “”;
- Declare a as an array of 10 integers and
initialize each occurrence
integer x;
x = 0;
while x < 11 do
a[x] = 0;
- Declare p as an array of 50 10-character
strings and initialize each occurrence
string[10] p[50];
integer x;
x = 0;
while x < 50 do
p[x] = “”;
Statements Section
The statements section defines the actual work performed by an extended rule. The section consists of a statement or a combination of statements (to perform more complex operations). A statement is a single operation that combines expressions, keywords, commands, operators, and symbols.
An expression is a logical unit (for example, A = B or A + B) evaluated by the translator. The statements section contains a sensible combination of expressions, keywords, commands, operators, and symbols. Each of these components is explained in detail in Extended Rule Keywords and Commands.