EXISTS

The EXISTS function is used to check that an item that is referenced in an argument exists in the database before a value is returned. For example, a symbol Mimic can use an EXISTS function in an expression to let a point value be displayed if the point exists in the database, but have no value shown if the point does not exist.

When using the EXISTS function, you need to be aware that the creation or deletion of a database item does not cause a re-evaluation of an expression. So, when an expression containing the EXISTS function runs, the expression is evaluated for that particular time - if the database item exists as that time, the EXISTS function returns True; if the item does not exist, the function returns False.

If the EXISTS function returns True, and subsequently the referenced item is deleted, the EXISTS function may continue to return True. The deletion of an item does not cause an expression to re-evaluate. Similarly, if a database item does not exist when an expression is evaluated, the EXISTS function returns False. If the item is subsequently created, the EXISTS function will continue to return False.

The EXISTS function can only update to reflect subsequent deletions or creations if the expression is re-evaluated. For example, an expression can contain an EXISTS function that references a point, as well as references to other tags. Changes in the values for the tags cause the expression to be re-evaluated, and so the EXISTS function is also re-evaluated. The result of the EXISTS function reflects whether the referenced point existed at the time of the re-evaluation.

EXISTS functions are used in the condition of an IIF function.

The EXISTS function is only available in client expressions. It cannot be used in server expressions.

Function Name

EXISTS

Description

Checks that items referenced in arguments exist in the database before a value is returned.

Arguments

EXISTS("Tag")

Where "Tag" represents any tag in an available database (see Tags)

Returns

BOOL

A Boolean value that indicates whether the item exists in the database (True). If the item does not exist, the EXISTS function returns a False value.

Example:

A text box on a Mimic shows the current value of a point named 'Analog Input 1'. The Mimic is a symbol Mimic and is embedded on more than one Mimic. If the point is not in the same location in relation to the other Mimics, the text box shows the string 'The point is not available'. This functionality is provided by the EXISTS function.

The text box on the Mimic is configured to have its Value property animated using the following expression:

IIF (EXISTS (".Analog Input 1.CurrentValue"), ".Analog Input 1.CurrentValue", 'The point is unavailable')

The Mimic is embedded on a Mimic named 'Region'. The 'Region' Mimic is stored in a group that also contains a point named 'Analog Input 1'. This means that the text box shows the current value of the point as there is a point in the same location as defined in the expression (the expression defines the relative location as the point being in the same group as the Mimic).

The Mimic is also embedded on a Mimic named 'Station 65'. The 'Station 65' Mimic is stored in a group that contains other Mimics but no points. This means that the text box shows the 'The point is unavailable' string as there is no 'Analog Input 1' point in the same location as defined in the expression (the expression defines the relative location as the point being in the same group as the Mimic).


Disclaimer

Geo SCADA Expert 2022