How can I build a condition in mathematical language?

  • Nolasol
    Asked on November 29, 2014 at 6:14 AM

    Hello,

     

    I think the available calculations and conditions are very important and great parts of JotForm's system.

    I think it would be more good to be able build a condition in the calculation field directly as a mathematical expression.
    Then I would be able to build a complex condition, including both AND and OR function in one formula (now I have to build conditions separated if contains AND and OR functions to same field).
    Now it's impossible because calculation field doesn't allow to insert '=', '<', '>' etc. symbols.

    For example a calculation in "TOTAL AMOUNT" field :

    ((DEP_COUNTRY_FIELD = "Spain") * (LINECODE_FIELD = 3) * (DEP_SPAINTOWN3)) + ((DEP_COUNTRY_FIELD = "Spain") * (LINECODE_FIELD = 1) * (DEP_SPAINTOWN1))

     (Yes, I know, this equation is not optimal and would be more simplified but I need to you understand what I would like to show you!)

    In this example if user selects 'Spain' as departure country and then selects a bus line No. 3, then she/he has to pay the calculation value of 'DEP_SPAINTOWN3'.
    If the user selects 'Spain' as departure country and then selects the bus line No. 1 (it's a different line with different ticket prices), she/he has to pay the calculation value of 'DEP_SPAINTOWN1'.

    Now I have to build two separated conditions for updating the value of 'TOTAL AMOUNT', first condition is "IF SPAIN and IF LINE 3, then SPAINTOWN3", and a next one is "IF SPAIN and IF LINE=1 then SPAINTOWN1" and I think it's more difficult and not optimal.
    Even if I have more parent fields and more conditions, then actual solution is much more difficult and would be simplified by a mathematical 'construction'.

     

    I need so much this option... :-)

     

    Thanks

     

    Noemi

     

  • Welvin Support Team Lead
    Replied on November 29, 2014 at 10:19 AM

    Hi Noemi,

    Are you suggesting to add the conditional logic option directly into the widget without using this method: http://www.jotform.com/help/268-How-to-Insert-Text-or-Mathematical-Caculation-into-a-field-using-a-Condition? Unfortunately, I'm not sure if that would be possible. For now, I would suggest adding conditional logic for each value that you want to insert into a field. I know that you have a few more options into your form as you've mentioned to your previous thread, but the conditional logic should also work.

    Or maybe, you can show the calculation fields and use "Ignore Hidden Fields" method? Then we'll try to hide it using custom CSS codes? How's that? 

    Thanks

  • Nolasol
    Replied on November 29, 2014 at 10:47 AM

    Hi Welvin again :-) ,

    yes, you understand me..

    OK, I will use conditional logic with separated lines for every conditions (I feel it would be more comfortable with a new option to use mathematical algorhytm to use as condition.)

    Yes, I found a solution to use "Ignore hidden fields" in a calculation.
    If I don't use any mathematical symbol (+, * etc.), only a list of included dropdown lists, then calculation works correctly and values of hidden dropdowns are disappearing from calculation :-)

    You can check result already in my form (#input_126, name: calc_inddij and then #input_105, name: indcimdij, label: "Címreállási díj" fields).

    Thanks for your help!

    Friendly

    Noemi

  • Welvin Support Team Lead
    Replied on November 29, 2014 at 12:13 PM

    Hi Noemi,

    That's great! If there are problems, just contact us again and we'll be glad to help.

    Thank you!