Variables

Variables store global and local data for instances. Instances hold, modify and share data using variables. A Flowchart comes with a number of predefined environment variables and mechanisms for defining new variables.

Variables values could be changed during Flowchart execution to support any finite-state machine logic required; a field of an outgoing packet can be filled by a current value of a variable; any part or a whole of a packet could be stored into a variable by a Receive Block. The packet data is saved in the decoded form with easy access to all the saved PDU fields by name.

Variables can be defined by a Flowchart and/or imported. Include files with variables definitions are supported.

Variables List


Variables List dialog can be opened:

Variables List dialog fields:

  1. Line number
  2. Variable name
  3. Variable data type
  4. Variable initial value
  5. Variable scope
  6. Variable source
  7. Comments
  8. Control buttons
  9. Comments
  10. Text includes list

All variables are visible via Variables List, but only variables defined via this dialog could be deleted through it. Variables defined via include mechanisms have to be deleted at the source.

Deleting a variable has dangerous side effects. It erases all operations and conditions associated with the variable throughout the Flowchart. Changing variables type may have the same effect. This behavior is by design. Making a backup copy of the Flowchart before attempting to delete a variable is strongly advised.

Edit Variable


Fields:

Variable Name

A variable name should start with a latter and may contain any number of alphanumeric characters and underscores. Names of API calls and some keywords are prohibited.


Variables Type

Data type of a variable defines what kind of a value the variable can hold.


Type Description
boolean Logical value. Can be ‘True’ or ‘False’.
bitStr Bit string type. Example: “10010100100011101010”
octetStr Octet string type. Example: “DE AD BE EF”. A pair of hex digits represents an octet (byte). Octets are space-separated.
charStr Common char string. Example: “Hello world”
objId ASN.1 object identifier type (section 31 of ITU-T Recommendation X.680)
any This is a UNION of other types supported. For example, during initialization one can address this variable as: VariableName.integer - to assign it an integer value; VariableName.boolean - to assign it a Boolean value. After the initialization, the variable acquires its final type, and keeps it for the rest of the test.

Complex Data Types

Variables of any data type present in the supported protocol specs no matter how complex can be defined. This allows FlowCoder to easily process any structured data present in packets sent/received.

FlowCoder allows saving, analyzing and modifying any fragment of any packet at any level of detail on-the-fly at any point of Flowchart execution.

Variables Scope


A variable is statically assigned one of the scopes:

A global variable may serve as a basic synchronization mechanism among instances.

The software guarantees atomicity of access to global variables and API calls. No special actions on the user part are required.

Initial Value

Any value of the same data type as the variable.


Operations With Strings

Addressing by index

x := charStr[7];

charStr[i] := "F";

x := octS[7];

octS[i] := 5;

bitS[19] := 0;

bitS[20] := 1;

Getting the length

charCount := Len(charStr);

octetCount := Len(octS);

bitCount := Len(bitS);

Adding strings

octS := "A5 CA D4";

octS := octS + "EF 56"; // add 2 literal octets

octS := octS + Str(Octet) + Str(yetOneMore); // add 2 octets from integer vars

octS := octS1 + octS2; // concatenate 2 octet strings

Comparison

== and <> comparisons supported for all strings, and work similarly to charStr type.