General Discussion

 View Only
  • 1.  Random Tip: Calculating the Number of Days between two dates - Take 2

    Posted 09-27-2022 22:40

    Take 1 of this tip was a bit of a mess from a formatting perspective, hopefully this one is better.

    A common scenario in form development for any industry might be having to take an action based on how much date/time has lapsed between two dates.
    This example will not cover all scenarios but once you understand the fundamentals, you can adapt it.


    1. End user enters the date of the Last Audit.
    2. If the Last Audit date is more than 365 days (8760 hours) since the last audit.
    3. Check a box indicating a violation.
    4. SMS the Supervisor/Manager with a message that this location (or asset, or warranty, etc) is in violation (or out of range, or past due, etc).
      (or send an email, or update a data repository or whatever)

    Building it:

    First, build all your questions and make note of the Unique Identifiers you give the questions as you will need some of them later.

    TIP: This is one reason you should have standards for how your unique identifiers are constructed. If your team spends the time to standardize it will save everyone
            a ton of time later as you won't have to go look for the Unique Identifiers when you need them in DREL, CONDITIONAL LOGIC, ANALYTICS etc.


            Question Label         Question Type                     Properties

    Q1: Last Audit Date:           Date/Time Selector               Range Validation property set to "In the Past"

    Q2: Current Date:               Date/Time Selector               using Page Start as default Date/Time (You would hide this from the end user)

    Q3: Hour Diff:                      Duration Math                       with the Start Date: 'Last Audit',  End Date: 'Current Date' (You would hide this from the end user)

    Q4: Violation:                      Single Checkbox                   (Controlled by Conditional Logic - See below)


    Solution in use:

    1. User enters the date of last inspection using a Date/Time selector with Range Validation set to "In the Past". (Required)

    2. Current Date is entered automatically as it is using the Page Start as the date/time. (Hidden on Device)

    3. Hour Diff: is populated automatically by the result of the calculation of hours between Last Audit Date and the Current Date.

    4. Conditional Logic:

        If the Duration Math question result - is greater - than 8760
        Is In 'Violation' (single checkbox question) - 'is set to' - Checked

    5. SMS Data Destination with the filter :
            Input Expression :     %a[Violation]
            Filter Expression:       Yes

    Additional Resources: Links to Product Documentation which discusses each.

    1. Date/Time Selector
    2. Default Value Source
    3. Duration Math
    4. Conditional Logic
    5. Applying Filtering to Destinations

    Stu Rathbone
    Program Manager ~ Knowledge, Training & Enablement

  • 2.  RE: Random Tip: Calculating the Number of Days between two dates - Take 2

    Posted 09-28-2022 15:16
    What a great guide, we often use the calculation to provide pro-rated invoices, so this could be invaluable for any additions or removals to service contracts.

    Keep 'em coming Stu!

    Andrew Small
    Operations Manager

Reminder: Content posted to our Community is public content.  Please be careful not to post Intellectual Property that you do not have permission to share.  For more information please refer to our Terms Of Use