You can have two results and for first use formula x>a
and for 1nd — NOT(x>a)
But I think you need something like Computed variables add-on.
I appreciate the timely response. Can variables store non-booleans, like ints or floats?
@sameagol varaibles can store ints, floats and strings.
Computed vars operates with ints/floats.
NOt-zero var in result’s formula becomes true.
See here for tech details: https://github.com/garex/wp-testing/blob/368b6ae10f009443e4cc8ba2675c7589433fe7b5/src/Model/Compilable.php#L93:L117
I see how it takes ints, floats, and strings.
I’m still trying to figure out how to store something like this in variables:
if(x > a){result = a}else{result = x}
Can this be done using computed variables:
[result = a] [x > a]
[result = x] [x >= a]
Yes.
For example in compuvars:
is_x_big: x > a
is_x_less: NOT(is_x_big)
is_result_a: is_x_big
is_result_x: is_x_less
Then in formulas just:
result a: is_result_a
result x: is_result_x
I am sorry for being unclear. In your example, you have two results, result a and result b.
I am looking for functionality which can assign either a or x to the same result.
if(x > a){result = a}else{result = x}
I hope this is possible! Thanks again for all the answers.
By “result” I understand a piece of text, that we show to respondent on results page.
Result will show if it’s formula is true.
- What do you understand by “result”?
- Why do you need it?
- Where do you want it to use?
I should not have used the word “result.” I mean variable.
For example, I want to find the minimum of two variables and assign it to a different variable.
a is a variable
x is a variable
minOfVariables = min(a,x)
I assume, if this is possible, one would have to have some kind of if statement, like:
if (x > a){minOfVariables = a}else{minOfVariables = x}
The reason I want to do this is because I’m doing some math on the scale scores. When doing math on these, it is important to be able to find the minimum or maximum of two variables to use later on.
I’m still don’t understand the whole image.
Such if can be replaced by math.
Currently there is no “if”s in plugin and I dont’ plan to introduce em.
If your case is too advanced, then you shouldn’t use this plugin or can use it but with custom written addon, that uses some of plugin’s extension points.
Ok, thanks for the support. I’ll consider a custom addon, though I’m hesitant because I’m new to web code and wordpress. Thanks again!