Calculate Total Based on the status of the field

  • Thattaway
    Asked on May 17, 2019 at 12:39 PM

    How can I get the "Total of Items Selected" field to calculate based on the items Accepted? See picture and form link. I figured out how to use the form calculation widget but all that does is just calculate the sum of them and doesn't account for whether or not they were accepted.

    Jotform Thread 1827265 Screenshot
  • roneet
    Replied on May 17, 2019 at 2:43 PM

    You can apply the calculation logic conditionally. Based on the status(Approved/Denied) you can set up the addition of your Form fields. Please refer to the screenshot here:

    1558118513form Screenshot 10

    Let us know if you have further questions.

    Thanks.

  • Thattaway
    Replied on May 20, 2019 at 9:33 AM

    https://www.jotform.com/edit/4341681172424093144

    Take a look at this submission. I set up the logic but when I changed the values to Accepted, nothing happened.

  • roneet
    Replied on May 20, 2019 at 10:29 AM

    Are you referring to this Form?

    https://www.jotform.com/91053551359154

    The link which you just shared is wrong and redirects to 404 error page. If you could throw some light on your requirement so that I would be able to setup the condition for you.

    when I checked the following "How can I get the "Total of Items Selected" field to calculate based on the items Accepted?" I could not find any field with "Total of Items Selected"

    Have you deleted it or referring to some other field?

    Please clarify this so that we can guide you further.

    Thanks.



  • Thattaway
    Replied on May 21, 2019 at 8:45 AM

    https://www.jotform.com/edit/4342510232421128676

    There's the link to an example. Here's what I'm trying to do.

    If the customer selects Accept, Decline, Decline (in order respectively as listed). I need total for interior drain to be 2700. If they select Accept, Accept, Decline. I need total for interior drain to be 2700+1650. If they select Accept, Decline, Accept. I need total for interior to be 2700 and total for sealed to be 8000. If the select Accept, Accept, Accept. I need the total for interior drain to be 2700+1650 and total for sealed needs to be 8000+1650.

    1558442603Capture Screenshot 10

    On a side note, you see how I added ______ to the end of each option? The reason I did that is because I wanted the Accept or Decline to be vertically aligned. I couldn't figure out another way of doing this. Is there a better way to align those options? Another idea would be to keep the lines but change the color of them to match the background color so they'd be invisible. Let me know what you think.

  • Richie JotForm Support
    Replied on May 21, 2019 at 10:06 AM

    As what my colleague has suggested, you may use calculated conditions to achieve your requirement.

    Here is an example: Make sure you use ALL in your rules so that the format would be followed.

    Calculate Total Based on the status of the field Image 1 Screenshot 30

    We can use custom CSS to align your fields or you can use the Move to a new line to move your question to a new line.

    Calculate Total Based on the status of the field Image 2 Screenshot 41

    I have tried to replicate your submission using my cloned form but I can't seem to make the fields to show. Can you please share to us the steps so that we can replicate the fields and try to align them?

    Looking forward for your response.

  • Thattaway
    Replied on May 21, 2019 at 10:10 AM

    Thanks Richie_P but your solution isn't sufficient for what I'm trying to accomplish. 2700 is a variable that can change based on how we price the job. That's a field that is specified when the submission is initially created.


    What would be the custom css to align the fields? I don't want to move it to a new line.

  • roneet
    Replied on May 21, 2019 at 11:19 AM

    If the customer selects Accept, Decline, Decline (in order respectively as listed). I need total for the interior drain to be 2700.

    You need to add the Price for Interior Drain field in the calculation widget here. Then pass it to the "Total interior Drain Investment field.

    Calculate Total Based on the status of the field Image 10

    2. If they select to Accept, Accept, Decline. I need total for interior drain to be 2700+1650.

    Calculate Total Based on the status of the field Image 21

    3. If they select Accept, Decline, Accept. I need total for interior to be 2700 and total for sealed to be 8000.

    Here, insert two conditions:

    a. One to insert a field for interior same as point 1. above.

    b. In the other condition put "Price for Sealed", pass this to "Total price for Sealed".

    4. If the select Accept, Accept, Accept. I need the total for interior drain to be 2700+1650 and total for sealed needs to be 8000+1650.

    Her, insert two conditions:

    a. One to insert the field "Price for Interior"+ "Price for dehumidifier" and pass it to "interior drain.

    b. In the other condition add fields "Price for sealed"+ "Price for Dehumidifier" and pass it to the field "Total for Sealed"

    Let us know if you are having issues in configuring these conditions. We will gladly assist you.

    Thanks.

  • Thattaway
    Replied on May 21, 2019 at 1:53 PM

    That's awesome roneet. Thank you. What would be the custom css to align the fields? I don't want to move it to a new line.

     

     
  • Richie JotForm Support
    Replied on May 21, 2019 at 3:09 PM

    You may try this custom CSS.

    #id_200{
    margin-left: 380px;
    }

    #id_220{
    margin-left: 380px;
    margin-top: -50px;
    }

    Guide:https://www.jotform.com/help/117-How-to-Inject-Custom-CSS-Codes

    Please give it a try and let us know how it goes.