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

  • Profile Image
    gradelink
    Asked 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))?

  • Profile Image
    aubreybourke
    Answered on November 16, 2017 at 03: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

     Hope that helps!

  • Profile Image
    gradelink
    Answered 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()?

  • Profile Image
    aubreybourke
    Answered 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.

    Form Calculation - Math Function Reference  

  • Profile Image
    gradelink
    Answered on November 16, 2017 at 04:15 PM

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