Skip to content

Assigning Values

These statements change the value of a variable or an attribute.

StatementWhat it doesExample
SET … TOAssign a value or expressionSET a_Status TO 1
=Assign directly (same as SET)v_Total = v_Total + a_Cost
INCIncrease, by 1 or a given amountINC v_Count · INC v_Count BY 2
DECDecrease, by 1 or a given amountDEC a_Stock · DEC a_Stock, 5
RESETReturn to the starting valueRESET v_Total
CLEARClear to the default (0, or empty text)CLEAR v_Flag

When you only need a value inside one block of logic, declare a local variable with Real (a number) or Int (a whole number). Its name is prefixed lv_, it exists only while that logic runs, and it is not shared with the rest of the model, unlike a global variable:

Real lv_LineTotal
SET lv_LineTotal TO a_Price * a_Qty
LegacyHow this worked in the previous version

( ) = ( ) This is the assignment statement which allows you to assign a value (or descriptor) to a variable or to one of the attributes defined for your entities.

YXNzaWduZWUgPSBhc3NpZ25vcg==

**assignee **The variable or attribute to which the value is assigned.

**assignor **The value assigned to the variable. This could be another variable or attribute, a pre-defined descriptor, or a mathematical expression.

Example

In the first example, the attribute a_ Attr1 is assigned a value of 2. The second example assigns the value of a_ PO_No to the attribute a_ Invoice_No . Number three assigns the descriptor Red to the attribute a_ Color . And the last example assigns the product of 5 and the value of Base to the attribute a_ Size.

  • a_Attr1 = 2

  • a_Invoice_No = a_PO_No

  • a_Color = Red

  • a_Size = 5 * Base

[

Logic Statements](/help/statements/)

The increment statement allows you to increment a variable or attribute’s value. It adds one (the default) or more to the value of the variable or attribute.

SU5DIG5hbWUgWywgZXhwcmVzc2lvbl0=

**name **This is the name of the variable or attribute to be incremented.

[expression] You can optionally increment the variable or attribute by more than one using an expression which can be a constant or a mathematical expression. The name and expression must be separated by a comma. (The square brackets illustrate only that this element is optional.)

Example

The following are several easy-to-understand examples. The first increments the value of v_ Var1 by one. The second increments the value of a_ Attr1 by five. And the third increments the value of v_ Number_in_System by the value of v_ Num_Processed plus one.

  • INC v_Var1

  • INC a_Attr1, 5

  • INC v_Number_in_System, v_Num_Processed +1

Logic Statements](/help/statements/)

Decrement of a variable or attribute’s value. It subtracts one (the default) or more from the value of the variable or attribute.

REVDIG5hbWUgWywgZXhwcmVzc2lvbl0=

**name **This is the name of the variable or attribute to be decremented.

[expression] You can optionally decrement the variable or attribute by more than one using an expression which can be a constant or a mathematical expression. The name and expression must be separated by a comma. (The square brackets illustrate only that this element is optional.)

Example

The following are several easy-to-understand examples. The first decrements the value of v_ Var1 by one. The second decrements the value of a_ Attr1 by five. The third decrements the value of Number_in_System by the value of an attribute called a_ Batch_Size.

  • DEC v_Var1

  • DEC a_Attr1, 5

  • DEC Number_in_System, a_Batch_Size

Combining the DEC statement with the INC statement allows visualizing work in process (WIP) in a model, an area of a model, or a queue. For example, a hospital might want to track the number of people in the waiting room to visualize waiting volumes when changing model operations.

How do I use a DEC Statement?

Plotting a variable captured with the INC and DEC statements.

How do I use a DEC Statement?

Using the INC and DEC statements combined to track the number of people in the waiting are of the ER.

How do I use a DEC Statement?

Using the DEC and INC statement combined to track the quantity of people in the waiting room.

Logic Statements](/help/statements/)