Calculate due dates based on user selection.

  • nick_blink
    Asked on June 11, 2018 at 12:42 PM

    This is my problem, I'm trying to calculate an "art due date" based on the selection of the requestor. Each option has a different amount of days that is needed for production.

    What I want done is if the requestor selects multiple options that the calculation takes the selection with the largest amount of days to make the art due date calculation. For some reason when it calculates it takes the option with the lowest amount of days. 

    Second issue that I having for some reason when certain selections are made the art due date calculates a date in 1970 and I don't know what is causing it. 

  • Mike_G JotForm Support
    Replied on June 11, 2018 at 5:53 PM

    I have checked your form and see what you mean. However, the issue with your form might just be a result of conflicts between the form conditions in it.

     

    For example — The Where will this be printed or do you need a print ready file? field is a Multiple Choice field that has 3 options. If more than one option is selected on that field, it produces a conflict between the conditions below resulting in the Art Due Date field to have a date in 1970.

    1528744346t15 10 09 Screenshot 10

    I have examined your form and its condition. And, I hope I was able to correctly understand how it works because I have a solution for you based on my understanding.

    To my understanding, the value of the Art Due Date field depends on these 5 calculations:

    Deployment/In Market Date field -1

    Deployment/In Market Date field -3

    Deployment/In Market Date field -5

    Deployment/In Market Date field -9

    Deployment/In Market Date field -14

    So it's either a day before the selected Deployment/In Market Date, 3 days before the selected Deployment/In Market Date, 5 days before the selected Deployment/In Market Date, 9 days before the selected Deployment/In Market Date, or 14 days before the selected Deployment/In Market Date.

    Then, those depend on the selected options in these 3 Multiple Choice fields — DigitalPrint & Digital, and Where will this be printed or do you need a print ready file?.

    If those are correct, I would suggest that you follow the steps below.

    Step 1 — Add 5 additional Short Text Entry fields in your form.

    1528751818t17 15 43 Screenshot 21

    Note: You can hide the fields later — How-to-Hide-Form-Fields

    Step 2 — Delete ALL the conditions associated with the Art Due Date field except for the 3 conditions shown in the screenshot below.

    1528750839t16 59 23 Screenshot 32

    Step 3 — Separate the options on all the three fields (DigitalPrint & Digital, and Where will this be printed or do you need a print ready file?) based on the number of days that it will deduct to the Deployment/In Market Date field.

    Click this to see the result

     

    Step 4 — Create the 5 conditions below which are based on the data collected in Step 3.

    1528751996t17 18 21 Screenshot 43

    Step 5 — Among the 5 additional fields (Deduct 1, Deduct 3, Deduct 5, Deduct 9, and Deduct 14), you will need to determine the one with the highest value. You will add a Form Calculation widget on the form and use the max() Math Function in order to do that.

    1528752844t17 32 51 Screenshot 54

    Step 6 — Create a condition that will deduct the value in the Form Calculation widget you added in Step 5 from the Deployment/In Market Date field to get the Art Due Date

    1528753280t17 40 41 Screenshot 65

    That's it. Test your form after.

    Here's is the clone version of your form where I have applied the steps above — https://form.jotform.com/81615130771956

    You can clone it to your account so you can inspect it better — How-to-Clone-an-Existing-Form-from-a-URL

    Note: Fields that should be hidden on the form were not hidden on the clone version for testing purposes.

    If you have questions regarding it, please do not hesitate to let us know.

     

  • nick_blink
    Replied on June 19, 2018 at 5:41 PM

    Thank you very much for this! This works great and a huge weight off my shoulders.

    One more ask in regards to this form. I would like to make the "Art Due Date" field read-only so someone doesn't go in and change the date manually. The problem comes when I make the date field read-only it collapses the field only showing two numbers of the date.
  • Mike_G JotForm Support
    Replied on June 19, 2018 at 6:09 PM

    You're most welcome! I'm glad that the solution works for you.

    With regards to your other concern, I have moved it to a new thread considering it is about another topic.

    https://www.jotform.com/answers/1503676

    I will be posting a reply in that thread shortly