True

(Engine-Level Function)

Description: For use in expressions that perform Boolean logic. Using "TRUE" will make your code easier to read than using "1".
Returns: With no parameters, returns the value, 1. If given a parameter, this function will return a 1 or 0 depending on whether the parameter evaluates to TRUE or FALSE. Always returns 0 if the parameter is Invalid.
Usage: Script or steady state.
Function Groups: Logic Control
Related to: False
Format: True[(TestExpr)]
Parameters:  
TestExpr
Optional. Any expression that evaluates to a 1 or 0 value. If no parameter is provided, then there is no need to include the parentheses.
Comments:

This function exists to make your code more readable. It is equivalent to

PickValid(Cast(Parameter, 0) == 1, 0);

For compatibility with the VTScada style guide, use all caps (TRUE and FALSE) when used as a constant. Capitalize only the first letter when used as a function call: True(test expression) and False(test expression).

Examples:

Given the following code in a simple page:

[
  Title = "OverviewLabel";
  Color = "<FFFFFFFF>";
  Y;
]

Main [
  ZText(100,100,Y ? "Y is true": "Y is false", 0,0);
  ZText(100,120,True(Y) ? "Y is true": "Y is false", 0,0);
  Return(Self);
]

Only the text at 100,120 will be shown. In the first call to ZText, Y is Invalid and therefore neither true nor false. The use of True(Y) in the second call to ZText ensures that the test always evaluates to true or false.