Variables

Top  Previous  Next

Variables contain context-related data. For example, the users.admin context has the childInfo variable (property) that contains a username, password, e-mail and some other properties of a given user. In AggreGate Server, value of every variable is actually a Data Table. Even simple numeric and string values are represented by one-cell Data Tables. This helps to a use a generic approach for the processing of variable values. All variables can be processed using the routines for handling tables (such as smart data table copy), even if they contain just a single number or string.

note_further-wt

Context variables are sometimes referred as properties. These two words are interchangeable in AggreGate jargon. They're one and the same.

note_warning-wt

Value of every context variable is a Data Table.

Variable Definition

Every variable is defined using a Variable Definition which contains several options:

Variable Name. The name is unique within context where variable is defined. This is a string that may contain only letters, numbers and underscore character ("_").
Variable Format. Table Format of the Data Table for the variable. This actually defines what the variable can look like - minimum and maximum rows, field types, possible field values, validation rules, etc.
Readable. Flag indicating that it is possible to get value of the variable from the context. This can be useful for sending messages to a device without getting a reply, such as when sending out a string to be displayed on an attached LCD screen.
Writable. Flag indicating that it is possible to change value of the variable to a new one.
Description. Description of the variable.
Help. Detailed description of the variable.
Group. Shows that variable belongs to a variable group. The group may be not defined, i.e, there can be variables which do not belong to any group. Groups help to select a number of variables for processing. For example, a Device context may have a Configure action for configuring the Device Account, and another action for configuring the hardware DS. Each action will operate with all variables of a separate group. Group name may be pre-defined on the AggreGate Server or come from some hardware device, but it cannot be changed by the user.
Read Permissions. Permission level required to get value of this variable.
Write Permissions. Permission level required to change value of this variable.

AggreGate Server processes variables in various ways. If you pass a Data Table as the value of a variable, you won't necessarily get the same exact table back when you try and retrieve the value of the variable.

Internally, variables are divided into several types:

In-memory structures that are not saved when AggreGate Server is stopped.
Persistent settings that are stored in the database.
Settings of Devices that are read/written from a remote device and cached by the server.
"Virtual" variables. The value of virtual variables is generated on-the-fly, and they're not permanently stored.

If there are problems in setting or getting variable values, an exception may be thrown. In the case of "get variable" operation, no value is returned. "Set variable" might throw an exception even though variable value was indeed set, due to some other reason. The exception contains a textual description of the problem.

Variable Status

Variables of AggreGate contexts may also have custom status. Variable status is a combination of a status code and human-readable status description.

Variables statuses are displayed in the leftmost column of Properties Editor. However, there are some other ways to see variable statuses. For example, statuses of device setting variables are shown in the Device Status dialog.

Examples

In the User context there is a variable called childInfo ("User Information"). Its value always contains one record (as specified by Variable Format) with several fields that store the user's first name, last name, phone number etc.

In the Event Filter context there is a variable called rules ("Filter Rules"). Its value may include numerous records ("lines"), each of describing an event type to be shown when the event filter is activated.