Hello @emilianomaina
Yes, that’s possible. Please, insert a dropdown field in the form with these choices:
* The following values and fields’ names are hypothetical, only to describe the process
First choice:
Text: Rome
Value: 1,2,3
Second choice:
Text: Milan
Value: 4,5,6
Third choice:
Text: Venice
Value: 7,8,9
Now, assuming the name of the dropdown field is fieldname1, and you want to get the raw value of the selected choice (without preprocessing). You should refer to the field in the equation with the |r modifier. For example, insert a calculated field in the form with the equation:
fieldname1|r
Of course, you should use in the equation the name of the dropdown field in your form.
Best regards.
Thanks for the prompt reply.
Not clear how, in the equation, access to the single field returned by the selected choice.
Hello @emilianomaina
I’m sorry, but I don’t understand what you want to do. You asked me about using a dropdown field with tuples as the values of your options.
Best regards.
Let me try to clariy.
Choosing the dropdown I have the tuple (a, b, c).
In another place I collect inputs d and e.
How can I access in the equation to single fields ?
I mean to crate a formula like (a-d)/(b-e)+c as an example.
PS I don’t understand the meaning of this syntax fieldname1|r
Hello @emilianomaina
The plugin tries to parse the fields’ values to use them in mathematical operations. The |r modifier says the plugin you want to use the field’s raw value without preprocessing.
So, the equation can be implemented as follows:
(function(){
var [a,b,c] = fieldname1|r.split(','),
d = fieldname2,
e = fieldname3;
return (a-d)/(b-e)+c;
})()
But using the real fields’ names.
Best regards.
Sorry but I am not able to make it working.
Now in a test form I have:
fieldname3 => Dropdown
fieldname4 => Calculated Field
In the calculated field, in the Set Equation of fieldname4 I wrote the following:
(function(){
var [a,b,c] = fieldname3|r.split",");
return a+b+c;
})()
Nothing displayed.
If I write simply fieldname3|r in Set Equation of fieldname4, the selected tuple is shown.
I don’t know what is wrong.
Hello @emilianomaina
You have a parser error in the equation, you have forgotten an open parenthesis. Please, use the equation:
(function(){
var [a,b,c] = fieldname3|r.split(",");
return SUM(a,b,c);
})()
Best regards.
Now it works!
Really thanks for your support.
You opened a new world to me.