Is there documentation for the conditional calculation function "nth()"?

  • gradelink
    Asked on November 16, 2017 at 2: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))?

  • aubreybourke
    Replied on November 16, 2017 at 3:37 PM

    The nth expression evaluates which of the supplied parameters is the highest. 

    Here's a demo:

    https://form.jotform.com/73195797428978

    It uses a form calculation widget. And is configured like so:

    1510864636Microsoft Edge 16 11 2017 20 3 Screenshot 10

     Hope that helps!

  • gradelink
    Replied on November 16, 2017 at 3: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()?

  • aubreybourke
    Replied on November 16, 2017 at 4: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.

    Form Calculation - Math Function Reference  

  • gradelink
    Replied on November 16, 2017 at 4:15 PM

    That reference sheet will work perfectly, thank you. I was confused about the appropriate syntax.