What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    How to get the biggest value like nth function, but that returns the label and the value?

    Asked by hbcmedia on December 17, 2014 at 02:27 PM

    I'm brand new to jotforms and created my first form, an assessment today. I used calculation fields to determine the score of several categories at the end of the form. I would like to identify and display the top 4 categories based on the scores of about 15 calculation fields. I was trying to do this with the Conditions Wizard but cannot figure out a way to do it without custom javascript that isn't supported within the wizard.

    I was looking to use Math.max or an array. I was able to get the largest values with the nth function but I need to return both the values and the labels of the fields with the four largest values.

    Another thought I had was to create a report and email that to the individual or embed it in the form somehow. I'm not sure if advanced functions are possible in reports but I would assume so. I just haven't found it yet.

    Any help would be greatly appreciated!



    This is a re-post of a comment on How to Pass Field Value to Another Field?

    Reports conditions wizard create custom javascript
  • Profile Image

    Answered by Ben on December 17, 2014 at 05:07 PM

    Hi,

    That would not be possible at this time, but what I would suggest is to create the Text field that would show this.

    For example, you can add something like this to Text tool:

    Section 1: {sectionOneFormCalculation}

    Section 2: {sectionTwoFormCalculateion}

    The text to the left can be anything, while the text on right must be a tag / field name that you want to show. You can see here how to find field IDs & Names.

    The similar can be done in the Email notifier and autoresponders.

    Unfortunately laying them out like that might be a tad difficult in reports, but if you give us a bit more details on this we would be able to request it as a feature if not possible otherwise.

    I have created a quick sample here: http://form.jotformpro.com/form/43506279500957

    It seems that our maximum functions in the Form Calculations are a bit off today, so that does not seem to get calculated but I am notifying our developers of this so it should be fixed soon.

    Do let us know if you have any further questions.

    Best Regards,
    Ben

  • Profile Image

    Answered by hbcmedia on December 18, 2014 at 10:24 AM

    Thanks for your answer and going to the trouble of making an example. Unfortunately, I'm not sure if is addresses my issue. I was hoping there was a way to return the label of the four largest categories. So for instance, if the categories and their respective values are are administration (15), teaching (19), mercy (5), encouragement (8), leadership (22), and giving (11), the top four in order would be leadership, teaching, administration, and giving. If I understand your suggestion, there would be no sorting of top variables from many categories.

     

    In essence, I was hoping there was a way to take a list/array of field values, run some math on them to find the four highest values, and then display both the value and the label for the value in order. This seems like it would be an essential function for teachers or employers looking to create useful assessments for their students or employees. I hope I can find this functionality somewhere. Otherwise, I'll see if I can whip up a javscript work around. My js is quite rusty though, so I wanted a turn key solution in jotform.

     

    Thanks anyway!

  • Profile Image
    JotForm Support

    Answered by Welvin on December 18, 2014 at 12:48 PM

    No worries, we are here to help.

    I think the sorting is possible using the calculation widget, and by using nth function which is the ideal for your requirements. However, I don't think adding the labels can be done using it.

    As for the custom Javascript codes, we can help you find one and add it to the form source codes of your form. But we would suggest finishing up the whole Jotform first so everything is final. Having the source codes means that you will be editing it outside Jotform. 

    Thank you!

  • Profile Image

    Answered by hbcmedia on December 18, 2014 at 01:31 PM

    Oh wow, thanks! I could definitely use some help in understanding how to make this happen. I've been looking at resources on w3c and overstack to try to figure it out but I'll bet someone with Javascript experience could do this in a couple of minutes.

     

    Here is the form. I've modified it to have three highest gifts. I would like to show both the score of the three highest gifts and the label. Any help would be greatly appreciated!

     

    http://form.jotformpro.com/form/43495044579970

     

  • Profile Image

    Answered by Ben on December 18, 2014 at 02:55 PM

    Hi,

    OK great, we will take a look at it and update you through this thread as soon as we have something to show.

    Please give us some time however since there are currently many threads that we must go through and building custom solutions is not considered as part of our usual work.

    Both my colleague and myself have however talked and will be working on this for you and as mentioned, update you as soon as possible.

    Best Regards,
    Ben

  • Profile Image

    Answered by dayspringchurch on February 28, 2015 at 11:09 PM

    I'm very interested in this also. I'm working on an assessment form for finding someone's 'money values' or 'money motivation'. The answers would have diff values and based on answers it will determine one of five or so ways they feel about money.
  • Profile Image
    JotForm Support

    Answered by jonathan on March 01, 2015 at 04:05 AM

    @ dayspringchurch

    I created a separate thread for you here http://www.jotform.com/answers/524678

    We will attend to it as soon as we can.

    Thanks.