Variables

Describes how Trayse Inventory uses Variables

Script Variables

Script variables are lower camel case, like field names. E.g.

$totalQty

$$totalQty

Variables for primary and foreign keys are also like the field names. E.g.

$itemID

$warehouseID

The ID is capital and at the end of the string.

Calculations are often defined inside a script variable instead of the Set Field definition. This makes it easier to see the variable before setting the field when debugging.

This

Set Variable [ $tempPendingValue ; Value: ORDERLINE::qtyPending * -1 ]
Set Field [ ORDERLINE::qtyPending ; $tempPendingValue ]


Rather than this

Set Field [ ORDERLINE::qtyPending ; ORDERLINE::qtyPending * -1 ]

Global

A handful of global variables are defined during the startup process. E.g.

$$systemPlatform

$$hostedPath

$$device

The variables defined at startup are intended to remain for the duration of the session.

Global variables defined in other scripts are created when it is easier than passing a local variable through various subscripts. These global variables are managed in such a way that they are cleared after user. This usually occurs at the end of a script:

Passing Variables

If a single variable is passed from one script to another, then the variable is listed as a parameter.

If multiple variables are passed, then those variables are defined in the script and packaged as a JSON object within another variable called $parameter. E.g.

Receiving Multiple Variables

Receiving multiple variables is done in two steps:

  1. Get the script parameter

  2. Unpack the JSON element

E.g.

Calculation Variables

Calculation variables occur in Let () statements and While () statements. These are prepended with an underscore. These variables are also indented by two spaces. E.g.

Last updated

Was this helpful?