Some responses in HyperSudy may need to be conditioned. For instance you may want to apply a different formula:
The first idea is generally to look for if/else, or case/switch statements as several programming code propose.
HyperStudy expression builder uses an Altair proprietary code, also used in HyperStudy for the parametized file, or in HyperView/HyperGraph/TableView for functions, notes, and parametrized sessions.
Templex does not contain neither if else nor switch/case statements, but still, it allows logical operations.
You can use <, >, <= and or >= operators.
If the condition between left hand side and right hand side is met, it will return 1. Otherwise, it will return 0.
Let’s say you would like to apply following statement:
If variable1 > 0
In the expression builder, you will write:
(var_1 > 0)*3+(var1<=0)*4
In the capture below var_1 is equal to 4:
For this you can use == .
As in the previous case, if the condition between left hand side and right hand side is met, it will return 1. Otherwise, it will return 0.
So let’s say your variable can take three discrete values 0, -1 and 1, and that you want to apply the following condition:
If var_1 = -1
response1 = var_1*var_2
Else if var_1 = 1
You can write:
(var_1==-1)*var_2 + (var_1==1)*var_3
You could also add (var_1==0)*0 for the third condition, but it is already respected with the expression above: