Variables

A variable is a symbolic name for a value. There are two basic properties of a variable:

There are two kinds of variables:

Port variables

The values of the port structure are referenced as port variables within a component. There are automatic port variables for both IN-ports and OUT-ports. Port variables are valid within the component, and they inherit the name and datatype of the port structure. The name of the variable is prefixed with IN. for the IN-ports and OUT. for the OUT-ports. 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

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 flexibility in transformations, all port and component variables internally use the datatype string. If you use numeric values, this may result in unexpected behavior.

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

Do not use any of these reserved JavaScript keywords for port and component variable names:

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