Conditions for time field based on date field

  • Profile Image
    countryk9
    Asked on December 05, 2020 at 11:09 AM

    New Customer Boarding Reservation - Testing Time Restrictions

    Boarding Reservations Page

    1st Check-In time field is for Monday-Friday 8-5pm April 1 - November 30

    2nd Check-In time field is for Saturday all year

    3rd Check-In time field is for Sunday all year

    4th Check-In time field is for Christmas eve hours 8-noon

    5th Check-In time field is for Monday-Friday 8-11am & 3-5pm December 1 - March 31

    Need to setup conditions to display Check-In Time and Check-Out Time based on the dates picked for the Check-In Date and Check-Out Date.

    For Christmas Eve (12/24), need to display a different Check-In time/Check-Out Time field. What I have tried displays the field but still displays the original at the same time.

    Need to display different Check-In Time/Check-Out Time fields for April 1 - November 30 and December 1 - March 31. What I have tried displays the field but still displays the original at the same time.

  • Profile Image
    Welvin
    Answered on December 05, 2020 at 05:14 PM

    You can set logic to target the day and specific dates (before and after). I would suggest adding a hidden calculation widget before/after the Check-In Date, and configure it to get the Date String, like the following:

    1607206127_5fcc04efcfadd_

    Click the ... icon to view the DateString function:

    math-functions-conditions-v4.png

    Next, set up your conditional logic like this:

    1607206213_5fcc0545b4e6a_

    The overall conditional logic is the following:

    1607206463_5fcc063fda905_Here's a demo form you can check with this method: https://form.jotform.com/203396226856059.

    I hope that helps.

  • Profile Image
    countryk9
    Answered on December 14, 2020 at 12:51 PM

    Can you provide more detail with the step "Click the ... icon to view the DateString function:". I'm unclear at what to do.

  • Profile Image
    Jessica
    Answered on December 14, 2020 at 04:37 PM

    Hi countryk9, thank you for reaching us.

    Please allow me to try to explain to you steps by steps.

    The solution that my colleague has suggested could be broken down into 2 steps.

    1. Using Form Calculator to identify what day is the dates
    2. Using Conditional Logic to show the time according to the day


    Using Form Calculator to identify what day is the dates

    Through our built-in feature, our Form Calculator offers a way to convert date into text.

    To do this, we simply need to add the following formula: dateString(select date field).

    1607981779_5fd7dad3c7189_OnPaste.2020121

    This will automatically allow output such as "Tue, Dec 16 2020", which is important to identify the days as there are different times for specific days.


    Using Conditional Logic to show the time according to the day

    Afterward, we can add as many dropdown option fields at different times. Taking my colleague's demo as an example, Time (5) contains a time range from 8AM to 5PM with 30 minutes differences.

    1607981793_5fd7dae164a71_OnPaste.2020121

    Then, we can simply add a condition to show Time (5). We can set Condition from Settings > Conditions within Jotform's Form Builder.

    Still following the demo my colleague has prepared as an example below:

    1607981805_5fd7daedf18d4_OnPaste.2020121

    The condition state, if the date is after November 30th, but before April 1th and the date string contains Mon, Tue, Wed, Thu, Fri, then it will show Time (5).

    This method can be repeated for other time fields based on a certain date.


    Let us know if it is still confusing for you.


  • Profile Image
    countryk9
    Answered on December 15, 2020 at 04:49 PM

    Clone of Existing Customer Boarding Reservation

    If Arrival Date: After "2020-11-30"

    If Arrival Date: Before "2021-04-01"

    and

    If Arrival Date: After "2021-04-01"

    If Arrival Date: Before "2021-11-30"

    I've tried using ANY and ALL if the rules are matched. Using ANY displays both Arrival Time dropdowns, ALL displays none.

  • Profile Image
    Ariel
    Answered on December 15, 2020 at 08:44 PM

    Hello there,

    Please note that the day of the week should be in ddd – three-letter abbreviation format, e.g. Tue.

    16080829622020-12-16 09_41_47.jpg

    Also, the "ANY" rule will not work in your case since you have a strict set of conditions.

    Let us know if you have any questions or if you need further assistance.

  • Profile Image
    countryk9
    Answered on December 16, 2020 at 11:22 AM

    Changed the the day of the week to ddd (Mon, Tue, Wed, Thu, Fri). Changed to ALL. Still no date field is being displayed.

  • Profile Image
    Kenneth
    Answered on December 16, 2020 at 12:42 PM

    Hi there,

    Using the same rules on the conditions, you may change the parameters for the "Value" to either "Sat" or "Sun" and select the field you wish to be shown:

    1608140334_5fda462ea01e5_y1.png

    I hope that helps.

    Best.

  • Profile Image
    countryk9
    Answered on December 16, 2020 at 03:22 PM

    Sat and Sun have nothing to do with the displaying the times for Mon, Tue, Wed, Thu, Fri.

    If Arrival Date: After "2020-11-30"

    If Arrival Date: Before "2021-04-01"

    If Date String Contains "Mon, Tue, Wed, Thu, Fri"

    If "All" of the "If" rules are matched,

    Show Arrival Time:

    No Arrival time field is displayed when I put in a date for Mon - Fri.1608150417_5fda6d9167926_Screenshot - No

  • Profile Image
    Jessica
    Answered on December 16, 2020 at 04:52 PM

    Hi countryk9, thank you for providing us with more information.

    It looks like the following Conditional Logic is what caused the conflict:

    1608155137_5fda80016b8c5_

    Please kindly disable or remove it so that the Monday to Sunday's Arrival Time could be displayed.

  • Profile Image
    countryk9
    Answered on December 21, 2020 at 10:32 AM

    I removed the Conditional Logic for Christmas eve. It displays the correct Arrival Time field for Dec 1 - March 31 but does not display the correct Arrival Time field for April 1, 2021 - Nov. 30 2021. I also need the one for Christmas Eve to work or really any holiday that we close half a day.1608564843_5fe0c06b939d4_Screenshot - Ar1608564843_5fe0c06ba8141_Screenshot - Ar

  • Profile Image
    Richie
    Answered on December 21, 2020 at 11:13 AM

    Please make sure you have selected the correct Arrival time.

    I would suggest you change your arrival time label to specific the correct field.

    Example. I have added AP in my arrival time field label to differentiate the dordpwon field.

    1608567017_5fe0c8e938de1_3.png

    Also, I would suggest hiding your arrival time fields as you're using the show condition.

    1608567102_5fe0c93e2a78f_4.png

    Further investigating your form, it seems your Date String form calculation widget is not working correctly as there is a space in your calculation.

    1608566958_5fe0c8aedfd26_3.png

    Kindly add the dateString calculation again and make sure there is no spaces.

    Let us know how it goes.