If statement
The ScriptWizard enables users to create a conditional function structure (similar to if-else) using the function "If statement".
Structure
In the following list you may find the corresponding explanations for every available setting possibility as well as push buttons of the function "if statement"
Variables
The list contains all available variables, which can be used to generate a condition.
$-Parameter
Similar to the variables the existing $-parameters are listed, so that they can be used in the condition.
Operators
The operators enable to create logical functions by just clicking the mouse. A function can also be inserted manually by using abbreviations, for example "==", "<=", "||", "&&", etc.
Condition
A logical condition is created in the input field for the condition, which is then used as the criterion for the condition. You can insert the elements as you wish to insert by double clicking on the variables, $-parameters and operators. Manual input is also possible.
If you type into the condition input field manually, It is not automatically tested weather the input is correct or not. Potential typing errors can only be found manually and need to be corrected manually.
The goal is to create a condition, which enables to distinguish between "applicable" (TRUE) and "non applicable" (FALSE). In the list under the condition text box you can choose only one already existing function which will be activated in case the condition is "applicable" (TRUE).
Example
The example in figure 1 shows the following:
If the value of variable "MyVariable" is not equal to ("!=") the value of the $-parameter "$ANYTYPE_MyDollarParam", then the function "MyDoSomethingFunction" is called. For example, If the value of "MyVariable" is 42 and the value of "$ANYTYPE_MyDollarParam" is 13, i.e. they have different values, then the function "MyDoSomethingFunction" is called.
Else Part
You can define which function is called If the condition is not met by selecting the option "Use else part" .
EXAMPLE
The else part extends the example shown in Figure 1, that if the value of "MyVariable" and the value of "$ANYTYPE_MyDollarParam" are equal, the function "MyDoNothingFunction" is called instead of the function "MyDoSomethingFunction".
Help
If you click on the "Help" push button, the WinCC OA 3.11 help file is opened, allowing you to access additional information about the function "If-Statement".
Apply
If you click on the push button "Apply", the ScriptWizard applies the conditions and functions you have selected and the "if statement" panel will be closed.
Cancel
If you click on the push button "Cancel", the functions you have defined will be discarded and the "if statement" panel is closed. Thus a new function can be selected for the ScriptWizard.