How to use conditional logic for date difference

  • AgilityAssoc.Canada
    Asked on August 4, 2019 at 11:07 AM

    Hello,

    On my form:  81646514559970, the conditional logic I created to compare two dates is not working.
    I want an error message to appear if the date entered into PAD is less then the date entered into TD.

    Layout:

    1564931085Scree 1 Screenshot 10

    Logic:

    1564931149Screen 2 Screenshot 21

    Published:

    1564931195Screen 3 Screenshot 32

    Can you help me resolve this issue please.

    best,
    Robert

  • AgilityAssoc.Canada
    Replied on August 4, 2019 at 11:33 AM

    Hi,

    I fixed the problem by using two calc fields and comparing there results... all is good now!

    TNX, Robert

  • AgilityAssoc.Canada
    Replied on August 4, 2019 at 11:49 AM

    Hi,

    Although my fix appears to work for the current year, if I enter 2017 as the PAD it will likely not show an error unless the day value is prior to the TD day value.

    My logic uses the current date and subtracts the TD date for one and current date minus the PAD date for the other. If the value for one is less then the value for the other show error.

    1564933706CompareDates Screenshot 10

    So I'm still confused by the results of my logic as it appears to work and it is backwards from what I would expect???
    ... Robert

  • AshtonP
    Replied on August 4, 2019 at 1:38 PM

    Your form calculation logic is working fine. I have checked your form and it works fine with any date from the past. I tried to select dates from 2017 and the conditional logic worked exactly the same it works for the current year.

    90655 Screenshot 64 Screenshot 10

    Feel free to get in touch should you still have any concerns.

  • AgilityAssoc.Canada
    Replied on August 4, 2019 at 2:06 PM

    Thank you... Robert