How to conditionally identify the day and calculate future dates based on it?

  • bakingfresh
    Asked on June 25, 2015 at 8:56 AM

    Hello,

     

    When someone orders my product, I want to tell them that their product will be delivered 3 days after the date of ordering. So for example, if a customer place an order on Monday, the form will tell them their product will be delivered on Thursday. And if a customer orders a product on Tuesday, it will tell the customer their product will be delivered on Friday. However I can not deliver on a Saturday, Sunday and Monday. So if a customer orders a product on Wednesday, Thursday or Friday, I want the form set up so it will automatically tell the customer their product will be delivered the FOLLOWING Tuesday.

     

    Many Thanks

    Stephen

  • Charlie
    Replied on June 25, 2015 at 10:42 AM

    Hi,

    I cloned your form for testing purposes, you can check it here: http://form.jotformpro.com/form/51753631601954.

    I unhide the current date field so that you can test it. I also added a Form Calculation widget that converts the date to a date string. Here's how it works.

    1. First, I reset the date limits in the delivery date. I then added a form calculation widget.

    How to conditionally identify the day and calculate future dates based on it? Image 1 Screenshot 40

    2. The form calculation widget will convert the current date to a string, I want to show the date in word format.

    How to conditionally identify the day and calculate future dates based on it? Image 2 Screenshot 51

    3. I will then use conditional logic to identify what is the current day.

    How to conditionally identify the day and calculate future dates based on it? Image 3 Screenshot 62

    You can clone my form to see how I set it up and you can also use that instead. Here's how you can clone my form: http://www.jotform.com/help/42-How-to-Clone-an-Existing-Form-from-a-URL.

    Let us know if that works.

    Thanks.

  • bakingfresh
    Replied on June 25, 2015 at 11:07 AM

    Hi

     

    Thanks for the detailed answer.

    I have come across an error I think though, it all works apart from when I change the "current time" to a Saturday or Sunday, the "You first box will be delivered on..." should say 30th June (aka the following Tuesday) however when I change the "current time" to a Saturday or Sunday, it shows nothing?

     

    Many Thanks

    Stephen

     

     

  • Charlie
    Replied on June 25, 2015 at 12:06 PM

    Hi Stephen,

    Yes, that is correct, there's no delivery date because I didn't put into consideration that you are expecting orders on weekends :)

    If that's the case, you can just add additional conditions to fill out the missing days (Saturday and Sunday). Here's the updated condition that I have:

    How to conditionally identify the day and calculate future dates based on it? Image 1 Screenshot 20

     

    You can check the form here again and see if it works as you expected: http://form.jotformpro.com/form/51753631601954?.

     

  • bakingfresh
    Replied on June 25, 2015 at 5:15 PM

    Hi Thanks for that.

     

    I am creating a new form that is the same as the one above expect the customer has to be told 2 different delivery dates. The 1st date works the same as above, and the 2nd date is 14 in the future from when the customer places the order. And again if this 2nd delivery date falls on a Sat, Sun or Mon, it needs to change to the following Tuesday.

     

    I am trying to copy what you done. But I'm confused. Do I need to create another "DateString"?

    And on your conditions you have the below, where is says "If Datestring" field Contain: Wed" however when I try and create this there is no "Wed" option to put in this box. All the options showing my end the names of my other fields.

     

    Link to form should you need: http://form.jotformeu.com/form/51755442842357

    How to conditionally identify the day and calculate future dates based on it? Image 1 Screenshot 20

  • raul
    Replied on June 25, 2015 at 6:44 PM

    Do I need to create another "DateString"?

    If both delivery dates depends on the same DateString then no, you can use the same value to create your conditions.

    And on your conditions you have the below, where is says "If Datestring" field Contain: Wed" however when I try and create this there is no "Wed" option to put in this box. All the options showing my end the names of my other fields

    You need to type the text on the condition

    How to conditionally identify the day and calculate future dates based on it? Image 1 Screenshot 20

    Please check the following cloned version of your form: http://form.jotformpro.com/form/51756765590972 and let us know if this is how it should work. You can also clone it to your account in case you want to check it further.

     

  • bakingfresh
    Replied on June 25, 2015 at 6:51 PM

    Hi

     

    Thanks for letting me know I just found, sounds daft now lol. But thanks think I got it working fine now.

     

    Many Thanks

    Stephen

  • Charlie
    Replied on June 25, 2015 at 11:43 PM

    Just a follow up, we just used the "DateString" function to identify what is the current date using the conditional logic "contains", currently, you cannot use conditiions to identify the day by using the date in number format (ex. mmddyyyy), so we need to change it to a string to get the current day in words.

    If you needed more assistance on this, I can look at the form you have and give you a hand, just let us know.

    Thank you. 

  • bakingfresh
    Replied on June 26, 2015 at 6:09 AM

    Hi

     

    Thanks for getting back to me.

    Yes please if you can look ay my form and double check it's set up they way I want it set up.

    The form in question can be found here: http://form.jotformeu.com/form/51755442842357

     

    I am creating a new form that is the same as the one above expect the customer has to be told 2 different delivery dates.(instead of 1) The 1st date works the same as above, and the 2nd date is 14 days in the future from when the customer places the order. And again if this 2nd delivery date falls on a Sat, Sun or Mon, it needs to change to the following Tuesday.

     

    Many Thanks

    Stephen

  • Charlie
    Replied on June 26, 2015 at 9:47 AM

    Hi Stephen,

    For the 2nd delivery, I believe you don't need to have additional calculation for Tuesday-Friday if it's 14 days in the future. This is because it will fall on the same day, exactly 2 weeks. So if the order was made on Tuesday, 14 days from that day is still Tuesday. 

    The only calculation that you will need for this is Monday, Saturday and Sunday.

    For Monday, just add 1 day, so +15 days.

    For Saturday, just add 3 days, so +17 days.

    For Sunday, just add 2 days, so it's 16 days.

     

    I've cloned your form and edited it, you can test it here: http://form.jotformpro.com/form/51764250464960?. You can also clone my form and see how I set up the conditions. 

    Here's a summary of my conditional logic.

    How to conditionally identify the day and calculate future dates based on it? Image 1 Screenshot 20

     

    Let us know if that works.

    Thanks.