How to use conditional logic for date difference

  • Profile Image
    AgilityAssoc.Canada
    Asked on August 04, 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.png

    Logic:

    1564931149Screen-2.png

    Published:

    1564931195Screen-3.png

    Can you help me resolve this issue please.

    best,
    Robert

  • Profile Image
    AgilityAssoc.Canada
    Answered on August 04, 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

  • Profile Image
    AgilityAssoc.Canada
    Answered on August 04, 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.png

    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

  • Profile Image
    AshtonP
    Answered on August 04, 2019 at 01: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.png

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

  • Profile Image
    AgilityAssoc.Canada
    Answered on August 04, 2019 at 02:06 PM

    Thank you... Robert