Hello @sodefradio
Thank you very much for using our plugin.
You have two alternatives:
* You can use the choices’ values as indexes and a plain object with the values.
For example, assuming you have the dropdown field fieldname1 with the choices’ values: A, B, C, …
You can insert an “HTML Content” field in the form to define the object:
<script>
var db = {
'A':[1,5],
'B':[3,7],
'C':[8,9]
}
</script>
And finally, in the equation you can refer to the values as db[fieldname1][0] and db[fieldname1][1], like:
db[fieldname1][0]*fieldname2+db[fieldname1][1]*fieldname3;
Note that the fields’ names, values, and the equation are hypothetical only to describe the solution.
* The second alternative would be to reach a consensus on the structure of the choices’ values.
For example, assuming you are entering the Dropdown (fieldname1) choices as follows:
First choice:
Text: A
Value: 1|5
Second choice:
Text: B
Value: 3|7
Third choice:
Text: B
Value: 8|9
This solution does not require to use an “HTML Content” field, but you should transform the values as part of the equation. The equation in the calculated field would be similar to:
fieldname1.split('|')[0]*fieldname2+fieldname1.split('|')[1]*fieldname3
Or to apply the split only once:
(function(){
var v = fieldname1.split('|');
return v[0]*fieldname2+v[1]*fieldname3;
})()
Best regards.