A variable is a symbolic name for a value. There are two basic properties of a variable:
Scope
Datatype
The scope of a variable decides in which scope of the environment the variable can be referenced.
The two kinds of variables are:
Port variables
Component variables
The values of the port structure are referenced as port variables within a component. There are automatic Port variables for both IN-Port and OUT-Port. Port variables are valid within the component, and they inherit the name and datatype of the port structure. The name of the variable is either prefixed with IN. for the IN-Ports and OUT. for the OUT-Ports. The IN-Port variables are read-only but OUT-Port variables can be written.
This example uses Port variables in an expression:
uUpper(IN.CU_NAME)
This example uses Port variables in a procedure:
OUT.CU_NAME = uUpper(IN.CU_NAME);
Component variables are associated with component properties and represent the current evaluated property content. You can reference these variables inside the component. The name of the variable is prefixed with REF, for example:
uIsNull(REF.Host)
To provide high flexibility in transformations, all port and component variables internally use the datatype string. This may result in unexpected behavior is you use numeric values.
If multiplied by 1, the numeric value of a string variable is used in a calculation:
IN.Margin="2", IN.Price="10" IN.Margin>IN.Price - returns TRUE
To enforce a numeric comparison use:
IN.Margin*1>IN.Price*1 - returns FALSE
The Port and Component variable names should not be any of the these JavaScript keywords:
Reserved JavaScript keywords |
||||
---|---|---|---|---|
break |
case |
catch |
continue |
default |
delete |
do |
else |
finally |
for |
function |
if |
in |
instanceof |
new |
return |
switch |
this |
throw |
try |
typeof |
var |
void |
while |
with |
abstract |
boolean |
byte |
char |
class |
const |
debugger |
double |
enum |
export |
extends |
final |
float |
goto |
implements |
import |
int |
interface |
long |
native |
package |
private |
protected |
public |
short |
static |
super |
synchronized |
throws |
transient |
volatile |
const |
export |