Support Forums
I/O Calculation Expressions

Hi all,

Is it possible to implement "IF" "ELSEIF" operator functions at the I/O tag expression level?

I would normally write my expression as...

IF ([06. Profile Section] == 6) THEN ;
((3.145 ([08. Width] / 2) ([08. Width] / 2) ([09. Length]) / 1000000000) 100) ;
ELSEIF ;
([06. Profile Section] == 7) THEN ;
(((3.145 ([08. Width] / 2) ([08. Width] / 2) / 2) ([09. Length]) / 1000000000) 100) ;
ENDIF;

If not does anybody know how i could implement this function?

Thanks in advance,

Joe.

Hi all, Is it possible to implement "IF" "ELSEIF" operator functions at the I/O tag expression level? I would normally write my expression as... IF ([06. Profile Section] == 6) THEN ; ((3.145 *([08. Width] / 2) *([08. Width] / 2) * ([09. Length]) / 1000000000) * 100) ; ELSEIF ; ([06. Profile Section] == 7) THEN ; (((3.145 *([08. Width] / 2) *([08. Width] / 2) / 2) * ([09. Length]) / 1000000000) * 100) ; ENDIF; If not does anybody know how i could implement this function? Thanks in advance, Joe.

You can do this using nested IfElse() statements. You can use the built in function helper (click the f(x) button when working on an expression) to use built in methods for If Than or If Else statements. (https://www.vtscada.com/help/Content/Scripting/Expressions/FunctionSelectionDlg.htm)

You can also use ternary operators to do the same thing though they can be confusting when trying to do an If Else statment.

To return the current value when no action should be taken, you should be able to use \value in your expression.

You can do this using nested IfElse() statements. You can use the built in function helper (click the f(x) button when working on an expression) to use built in methods for If Than or If Else statements. (https://www.vtscada.com/help/Content/Scripting/Expressions/FunctionSelectionDlg.htm) You can also use ternary operators to do the same thing though they can be confusting when trying to do an If Else statment. To return the current value when no action should be taken, you should be able to use \value in your expression.

Trihedral Engineering Ltd.

Thank you for your response Dave...

I managed to complete my task by using the 'Ternary Operator (IfElse)'.

Expression example below:

([06. Profile Section] == 6)
?
((( [07. Height] 3.0 2.0) + (([08. Width] - 3.0) 3.0 2.0)) / ( [07. Height] [08. Width])) + ((([08. Width] - 6.0) ( [07. Height] - 3.0) 2.0 40.0 / (([08. Width] [07. Height]))) / [09. Length])
:
([06. Profile Section] == 7)
?
((( [07. Height]
6.0 2.0) + (([08. Width] - 6.0) 3.0 2.0)) / ( [07. Height] [08. Width])) + ((([08. Width] - 6.0) ( [07. Height] - 6.0) 2.0 40.0 / (([08. Width] [07. Height]))) / [09. Length])
:
0

Thanks again smile

Thank you for your response Dave... I managed to complete my task by using the 'Ternary Operator (IfElse)'. Expression example below: ([06. Profile Section] == 6) ? ((( [07. Height] * 3.0 * 2.0) + (([08. Width] - 3.0) * 3.0 * 2.0)) / ( [07. Height] * [08. Width])) + ((([08. Width] - 6.0) * ( [07. Height] - 3.0) * 2.0 * 40.0 / (([08. Width] * [07. Height]))) / [09. Length]) : ([06. Profile Section] == 7) ? ((( [07. Height] * 6.0 * 2.0) + (([08. Width] - 6.0) * 3.0 * 2.0)) / ( [07. Height] * [08. Width])) + ((([08. Width] - 6.0) * ( [07. Height] - 6.0) * 2.0 * 40.0 / (([08. Width] * [07. Height]))) / [09. Length]) : 0 Thanks again :)
55
2
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft