Skip to main content

Hi

I have a number of fields where users can choose from option A to E, with A being the highest value.  I need to find out what the highest value is that has been chosen out of any of these fields.

For example:

Field 1 value chosen B

Field 2 value chosen E

Field 3 value chosen A

The highest value is A, which is in field 3.

Field 1 value chosen C

Field 2 value chosen B

Field 3 value hosen D

The highest value is B, which is in field 2

Is it possible to get these fields into an array or set of value that I can sort and then pick the highest or something.  Any help is highly appreciated happy.png.

Thanks

is this in workflow?  you can use the collection operation action to add these fields into the collection and then sort etc


Sorry, this is in a form.


within the form you could do it eg. following way.

place a calculated control on the form and set its formula following way.

f1-f4 are named controls which 'highest value' is evaluated

String.fromCharCode(min([f1.charCodeAt(0),f2.charCodeAt(0),f3.charCodeAt(0),f4.charCodeAt(0)]))

it's little tricky but hopefully you will  manage to get it working.


That's an awesome solution, thanks Marian.  Great to know also that it's possible to add JavaScript into a formula.  Is it possible to add multiple lines of JavaScript code?


to be honest, I've tried that before.

but why not happy.png


Great, thanks Marian


Hi Marian,

  1. I have a 5 of fields where users can choose from option (Incidental,Minor,Moderate,Major,Sereve) , with Sereve being the highest value.  I need to find out what the highest value is that has been chosen out of any of these fields.

 

For example:

Field 1 value chosen Incidental

Field 2 value chosen Minor

Field 3 value chosen Moderate

Field 4 value chosen Major

Field 5 value chosen Sereve

The highest value is Sereve, which is in field 5.

Field 1 value chosen Incidental

Field 2 value chosen Minor

Field 3 value chosen Moderate

Field 4 value chosen Major

Field 5 value chosen Incidental

The highest value is Major, which is in field 4

Field 1 value chosen Incidental

Field 2 value chosen Minor

Field 3 value chosen Incidental

Field 4 value chosen Incidental

Field 5 value chosen Incidental

The highest value is Minor, which is in field 2

  Any help is highly appreciated ?.


this seem to be completely different problem to the one discussed in this topic.

I'd suggest to start new question.


Reply