Using CitectSCADA > Using Labels

Using Labels

Labels allow you to use a series of commands (or expressions) in your system without having to repeat them each time they are used. When you compile the project, the commands (or expressions) defined in the label are substituted in every occurrence of the label.

Labels are similar to macros used in programming languages such as Basic or 'C'.

You often use the same combination of statements in different commands. For example, when an operator acknowledges an alarm, you might want to log the details to a file. Such a command would require several statements:


FileWrite(AlrmFile, Time()); FileWrite(AlrmFile, Date()); . . .

Instead of entering the same statements when necessary in a command, you can define a label, and then use the label instead of the statements. When you compile your project, each occurrence of the label is resolved; that is, the expression in the label is substituted for the label name. For example:

Once defined, a label can be used as a statement in a command, for example:

When an operator issues this command, the expression defined in the label is substituted in the command.

You can also use the label in combination with other statements, for example:

The main advantage of a label is that it is a global definition, recognized throughout the CitectSCADA system. If you want to change something (in the above example you might change the file name or the way the data is logged), you only need to change it in one place - in the label definition. Other occurrences of the label name will reflect the changes.

See Also