Why conditional logic doesn't work properly in my form?

  • ngmsys
    Asked on August 5, 2017 at 10:50 AM

    But the conditional logic still doens't work well.

    I need to realize quite simple algorithm: if option checked in the checkbox then I multiply a value of a field on some coefficient. I create a new rule: if checkbox contains then value of field1*on the coefficient. F.E. if client needs chosen design I increase the total price on 25%.

    It doesn't work because:

    a) every time when click on value of the checkbox the condition applied. 

    b) If target option is checked the condition is triggered as many times as the number of values selected in the checkbox.

    Finally I need to realize certain logic. The coefficient should depends on which option is selected in the checkbox. I've tried to use a hidden field to save coefficient value but it doesnt' work because of bags that I described above.

    I've used different types of checkboxes but the result is the same.

    How can I implement required logic?

    Thanks in advance

  • Nik_C
    Replied on August 5, 2017 at 3:11 PM

    Could you please share the Form ID where you have this problem so we can check.

    Thank you!

  • ngmsys
    Replied on August 7, 2017 at 3:15 PM
  • Mike_G JotForm Support
    Replied on August 7, 2017 at 4:30 PM

    I would like to apologize for any inconvenience. It seems that your requirements are attainable, however, I believe it would be best if you can tell us every field in your form that is involved in the computation in order for us to get the total. If you can also let us know the exact steps that need to be taken on your form to get the total, that would be great.

    We will wait for your response.

  • ngmsys
    Replied on August 8, 2017 at 3:40 PM

    There are two calculated fields - input53 (min price) and input54 (max price).

    The formula depends on values of check2 (input_26). There are options that influence on min and max price. Our goal is quite simple. We'd like to apply different coefficient depends on selected options.

  • Nik_C
    Replied on August 8, 2017 at 4:32 PM

    Thank you for additional information.

    If you were referring to this condition: 

    Why conditional logic doesnt work properly in my form? Image 1 Screenshot 50

    when I tested it worked, it calculated correctly:

    Why conditional logic doesnt work properly in my form? Image 2 Screenshot 61

    And I entered 50 in Общая площадь, м2 field, so Сумма от was correct.

    The same was for the other field Сумма до.

    Now, since you need this field included in the calculation:

    Why conditional logic doesnt work properly in my form? Image 3 Screenshot 72

    I'm afraid that it won't work since conditions don't recognize what is selected. So you could replace it with a regular check box:

    Why conditional logic doesnt work properly in my form? Image 4 Screenshot 83

    And that will work with calculations, I just tested.

    You can check my cloned version of your form: https://form.jotformpro.com/72195804786973

    I set that if you select the first option, it will deduct the 10% from the Сумма от field.

    Could that work for you by any chance?

  • ngmsys
    Replied on August 9, 2017 at 2:14 AM

    I used #input_63 because logic with checkbox values don't work. Even now I've got errors. Let's see last submissions. The calculated fields are empty. 

    Get Page URL https://stroyalty.ru/express-smeta
    Выберите тип помещения Другой вариант
    Общая площадь, м2 130
    Количество комнат 8
    check2 Перепланировка
    Демонтажные работы
    Сантехнические работы
    Электромонтажные работы
    Установка межкомнатных дверей
    Разработка дизайн-проекта ДА
    check3 В течение месяца
    Имя Виталий
    Phone Номер телефона: 8 985 147 31 83
    Email E-mail: @gmail.com
    Сумма от 0
    Сумма до 0
  • Nik_C
    Replied on August 9, 2017 at 3:49 AM

    Could you please tell us how Сумма от  and Сумма до should calculate when these fields are selected:

    Why conditional logic doesnt work properly in my form? Image 1 Screenshot 20

    So we can try to create a working example?

    We'll wait for your response.

    Thank you!

  • ngmsys
    Replied on August 9, 2017 at 1:12 PM

    Right now I exclude checkbox from formula because it doesn't work correctly. Instead of that I have to use input_64. To find error:

    1. Just add condition "if checkbox2 contains "дизайн" (or any other value) then multiply field "Число" (input_62) on 1,5 (for example). 

    2. Make several tests, choose different configuration of checkbox values. See what's happened with coefficient (field Число (input_62)))

    Additionally select and deselect checkbox values several time before submission. Again, see what's happened with coefficient.

  • Nik_C
    Replied on August 9, 2017 at 1:28 PM

    So if any field is checked from here:

    Why conditional logic doesnt work properly in my form? Image 1 Screenshot 40

    Insert 1.15 in Число field.
    That will work with this condition:

    Why conditional logic doesnt work properly in my form? Image 2 Screenshot 51

    And if you need to check each option individually you can use this condition:

    Why conditional logic doesnt work properly in my form? Image 3 Screenshot 62

    If you need to calculate the coefficient separately for each option.

    Here is my test form: https://form.jotformpro.com/72195804786973

    Could that work for you?

    Thank you!

     

  • ngmsys
    Replied on August 9, 2017 at 2:49 PM

    1. Field should be multiplied on coefficient depends on options. F.E.

    If option 1 selected that coef*x

    If option 2 selected that coef+y

    ....

    I see that you used other checkbox. I didn't try it.

    It doesn't work for existing checkbox that I use in the form.

     2. Select Разработка дизайн-проекта then unselect this option. The coef will not be changed. So, coef should be calculated on submission instead of click. 

     

  • Nik_C
    Replied on August 9, 2017 at 3:21 PM

    Yes, the existing field you used will not work so I replaced with regular check box field:

    Why conditional logic doesnt work properly in my form? Image 1 Screenshot 30

    Since there you can use a condition like this:

    Why conditional logic doesnt work properly in my form? Image 2 Screenshot 41

    And you can create such condition for each option when it is selected insert appropriate value in your Число field.

    We could help you with creating such conditions just let us know which coefficient should go to Число field for which choice?

    We'll wait for your response.

  • ngmsys
    Replied on August 13, 2017 at 4:42 PM

    I've updated the form as you suggested. It doesnt work again.

    Test case: Please activate conditions that stopped now and enjoy unlogical logic of your calculations. I dont understand how it is calculated. F.e. simple logic: if Field1 = Value then calculate Field1 + 15000, update Field1. Finally I got the value that I can explain using my math skills. There is the same problem for each stopped condition. 

    Additionally, the field is calculated when user make a click on checkbox value. If he\she unselect the value a calculated field will no be updated.

    Guy, I've tried to implement a pretty simple logic 2 months and I'm tired to do it. I like JotForm support team but I don't understand what your product team is doing.

  • ngmsys
    Replied on August 13, 2017 at 4:46 PM

    https://form.jotformeu.com/71133051103335

  • Welvin Support Team Lead
    Replied on August 13, 2017 at 6:42 PM

    Please allow me a few minutes to check this for you. It's the language that takes me time. I'll let you know. 

  • Welvin Support Team Lead
    Replied on August 13, 2017 at 7:15 PM

    You may need to rebuild your conditional logic settings and target more fields instead of just one then sum them up to get the final amount/total.

    Your conditional logic #1 and #2 (Total Area, M2) will create a conflict to the other conditional logic for the field "Укажите, пожалуйста,  какие услуги необходимо включить в смету.". Why? Because they are targeting the same field. The result field is the same. 

    Plus, you are using a checkbox for the "Укажите, пожалуйста,  какие услуги необходимо включить в смету." field. Each option has its own conditional logic to target the same field. Since it is a checkbox type, users may be able to select two or more options. The conditional logic won't work this way because it cannot detect which is which/what condition to follow. 

    My solution is the above, to add more fields. You have 7 options including the other, so add 7 more fields. One field equivalent to one option from the checkbox.

    Here are your conditions showing the conflict: 

    Why conditional logic doesnt work properly in my form? Image 1 Screenshot 20

     

    These includes condition #1, #10, and #11. 

    I hope that helps. Let us know if you need further assistance.

  • ngmsys
    Replied on August 14, 2017 at 3:36 AM

    1. Correct!

    Total prices (Сумма от  (min price) and Сумма до (max price))  are calculated based on selected options. User could check all of them potentially. System must execute all these conditions in the order that is defined.

    2. Anyway, just activate the last two conditions and see what's going on. It doesnt work eben you acivate only one formula if checked value that field1+number and record resul in the field 1.

     

  • Chriistian Jotform Support
    Replied on August 14, 2017 at 3:59 AM

    I'm currently checking your form. Please allow me some time to further check the conditions. I'll get back to once I'm done.

  • Chriistian Jotform Support
    Replied on August 14, 2017 at 4:38 AM

    I cloned your form and I noticed that there are only 3 conditions that are enabled on your form. The rest are disabled.

    These three conditions are currently working on your form.

    Why conditional logic doesnt work properly in my form? Image 1 Screenshot 20

    Regarding the other conditions, I'm not sure which of the last two conditions that you have enabled don't work. Could you please point them out for us? 

    If possible, please send us a screenshot image in this thread. Here's the guide on How to add screenshots/images to questions to the support forum?

    As mentioned by my colleague, you need to add separate fields for the different options as their target fields to avoid condition conflicts.

    Related Guide: How to Show or Hide Fields Base on User's Answer.

     

     

     

     

  • ngmsys
    Replied on August 16, 2017 at 5:56 AM

    Again, you need activate disabled conditions. They are disabled because it doesn't work. It clear that 3 active conditions work. 

    I'm pretty clear describe the problem. Please test it before write me what I should do. 

    Test-case 1

    1 Deactivate all conditions.

    2 Activate only one condition (last one).

    3. Check the value. We get a fantastic value.

     

    Test-case 2

    1 Deactivate all conditions.

    2 Activate 2-3  conditions.

    3. Check the values. It will wrong.

     

  • jonathan
    Replied on August 16, 2017 at 7:42 AM

    May I ask why you cannot just delete the disabled conditions on the form?

    Conditions #2 and #3 were actually conflicting since both have the same IF condition

    Why conditional logic doesnt work properly in my form? Image 1 Screenshot 30

    Why conditional logic doesnt work properly in my form? Image 2 Screenshot 41

     

    To fix the conflicting conditions, need to change one of the IF rule.

    Let us know if this will not work.

     

  • ngmsys
    Replied on August 18, 2017 at 3:07 AM

    You didn't answer on my question. Please try to understand how it works before asnwer me.

    I already explain that conditions # 1-3 have been created because the disabled conditions have not worked correctly.

    At the same time condition #1-3 work absolutely correctly right now. These conditions should be applied only if the field  Общая площадь is filled.

    Please do the following:

    1. Read all my comments regarding condition logic and bugs that we found.

    2. Copy the form

    2. Delete conditions #1-3

    4. Implement test cases that I described above.

    5.  Don't write me before you really test it 

    Again I spend too much time to implement pretty simple logic. If I can't do it in the nearest future  I will have to cancel subscription and change a supplier.

     

    Thanks in advance.

  • Chriistian Jotform Support
    Replied on August 18, 2017 at 4:55 AM

    Sorry for the inconvenience.

    Rest assured I have read all the comments and information in this thread. I also did the test cases as you mentioned. 

     

    Test-case 1

    1 Deactivate all conditions.

    2 Activate only one condition (last one).

    3. Check the value. We get a fantastic value.

    Why conditional logic doesnt work properly in my form? Image 1 Screenshot 50

     

    This condition below will not work because you are using the field as the coefficient and at the same time as the field which the result will be displayed.

    Why conditional logic doesnt work properly in my form? Image 2 Screenshot 61

    The field that will be used as a coefficient should not be the same as the target field to avoid condition conflict.

     

     

    Test-case 2

    1 Deactivate all conditions.

    2 Activate 2-3  conditions.

    3. Check the values. It will wrong.

     

    Why conditional logic doesnt work properly in my form? Image 3 Screenshot 72

     

    I did this test case and it is working on your form.

    Why conditional logic doesnt work properly in my form? Image 4 Screenshot 83

     

    I came up with a conclusion that you want to get the results of multiple conditions/calculations in a single field like the fields (Сумма от and Сумма до) but unfortunately, this will not work because it will result in condition conflicts. Please try what we have suggested that you need to add separate fields for the results of every condition/calculations.

    If still doesn't work or if I misunderstood your process, please clarify to us a bit more and please do get back to us.

    We'll wait for your response.

     

     

  • ngmsys
    Replied on August 23, 2017 at 3:37 AM

    You suggest me to add a hidden field for each option to save coefficients, am I right?

    I think it's an inappropriate solution. 

    1. I have to spend a lot of time to do it. I pay for your service to make my life easy. You suggest me to spend time because you can not design and implement correct and transparent logic.
    2. I need to add many unnecessary fields on the form just to make simple calculation.

     

    Additionally, if I have more then 5 conditions it's quite difficult to work with it. 

    The better way to work with calculation is to make one condition where user can configure different scenarios.

    If option 1 is value then formula 1

    If option 2 is value then formula 1

    If option 1 > value and option 3 > value then formula 1 then formula 3

    ....

    Output field: Field X

    So, conditions connected with calculation the same field should be grouped.

     

    There are a lot of questions for your product team.

    Finally, It seems that easier to swap form designer to get required capabilities.

  • Nik_C
    Replied on August 23, 2017 at 4:06 AM

    We are sorry for this inconvenience, but I must agree with my colleague when it comes to using the same field in calculations and for result field. That will just not work. Calculations like that require additional field for the result, so you could simply add one more result field and point the calculation there.

    I created a simple form that shows how the calculation you were trying to implement works:

    Why conditional logic doesnt work properly in my form? Image 1 Screenshot 30

    So for test1 and sum, the numbers are 1 and 1, the result should be 1+1*2000 which is 2001 but it is showing 20001 because it can not save the middle score automatically.

    The easy solution would be to create another sum field and point the result to go there:

    Why conditional logic doesnt work properly in my form? Image 2 Screenshot 41

    If that couldn't work for you, we could forward to our backend team for an additional check.

    We'll wait for your response.

    Thank you!