- gradelinkAsked on November 16, 2017 at 02:41 PM
I am messing around with some conditional calculation and discovered that I could insert functions. I am interested in using the "nth()" function, but I'm not sure exactly how to call it.
For example, would I just write nth(item1, item2, item3, item4, item5)? I feel like this is wrong because I'm not defining what the "n" value would be.
However, if I include the "n" do I need to enclose the items I'm sorting in parantheses i.e. nth(3, (item1, item2, item3, item4, item5))?
- JotForm SupportaubreybourkeAnswered on November 16, 2017 at 03:37 PM
The nth expression evaluates which of the supplied parameters is the highest.
Here's a demo:
It uses a form calculation widget. And is configured like so:
Hope that helps!
- gradelinkAnswered on November 16, 2017 at 03:50 PM
That answers some questions, but creates more: if nth() merely returns the highest value in a set, how is it different from max()?
- JotForm SupportaubreybourkeAnswered on November 16, 2017 at 04:06 PM
The nth() function can also specify an additional parameter. This will be 1 for the first biggest number, 2 for the second biggest number, etc
While the max() function just returns the biggest number.
- gradelinkAnswered on November 16, 2017 at 04:15 PM
That reference sheet will work perfectly, thank you. I was confused about the appropriate syntax.