Graphics Builder > Genies > Create a New Genie > Use the IFDEF Macro

Use the IFDEF Macro

Genies are customizable, reusable objects that are even more flexible when used with the IFDEF macro. With the IFDEF macro, during compilation it is able to detect if a Genie substitution is valid or not. If the substitution is not valid you are able to hide it from the page, thus making your Genies more generic and reusable in more contexts.

Note: In Citect SCADA, using the IFDEF macro is considered an advanced configuration scenario.

The expressionA statement (or group of statements) that returns a value. An expression can be a single variable, a mathematical formula, or a function. entered in the Hidden When field of an object's property is used to determine if the object will be visible on the page at runtime. The expression evaluates to either TRUE or FALSE and the object is hidden when the expression is TRUE.

You define the variable tag and conditions under which the object is hidden by entering an IFDEF statement into the Hidden When field when you configure the object. The IFDEF statement is evaluated by the compiler and the value of the resulting expression or variable tag will determine whether or not the object is hidden.

This can significantly reduce the number of necessary Genies, as the configuration engineer does not need to generate several smaller Genies to cater to operations driven by a slightly different range of tags.

The IFDEF statement consists of three arguments:

IFDEF (<"Tag Reference">, <Result value if tag defined>, <Result value if tag 
undefined>)

The first includes a tag reference (variable tag name or 'Equipment.Item'). If the variable tag is defined in the tag database at project compilation, the IFDEF statement is replaced in the Expression field by the second argument. If the variable tag is undefined, the Expression field will contain the third argument, displaying a value of a tag that may not be defined in your project.

See Also

Published June 2018