Dynamically Assign and Adjust Dates with Date_CALC Block

Use Cases

 

Step-by-Step Instructions


Restrict date selection to a specific number of days from the current date

Capturing the Current Date Using a SET_VAR Block

  1. Add a SET_VAR block before the FORM block where users will select a date from the DATE Picker field.

    SET_VAR before FORM.png

  2. Click on the SET_VAR block to edit its properties and select "Create new variable" from the Select Function dropdown.
  3. Under Create new variable, set the Variable type to Datetime and assign a variable name (e.g., CurrentDate).
  4. In the Select date dropdown, choose "Current Date" to capture the current system date.

    SET_VAR config.png

Adding Days to the Current Date Using the DATE_CALC Block

  1. Add a DATE_CALC block and create a route from the SET_VAR block to connect them to each other.

    DATE_CALC from SET_VAR.png

  2. Click on the SET_VAR block and select "Add time period to date" from the Select Function dropdown.
  3. In the Add time period of field, enter the required number of days, and select "Days" in the Select unit of time dropdown.
    • Note: The current day is included in the count. To select a date after the 10th day from today, set the value to 11 days.
  4. In the Select date variable field, choose the variable that holds the current date (e.g., CurrentDate).
  5. Select the preferred date format from the Format Date as dropdown.

    DATE_CALC config.png

Using the DATE_CALC Result to Set a Minimum Date for the Date Picker Field

  1. Select the FORM block where users will select a date, then click "Open Form Builder."
  2. Add a DATE PICKER field to the form.
  3. In the Property Editor, navigate to the Field Validation section.
  4. Select the "By date variable" radio button.
  5. Under Optional minimum date, enter the variable name assigned in the DATE_CALC block.

    Date PICKER configuration.png

Output Preview from Test Run

Below is the result when the user attempts to select a date while the current date is March 4, 2025.
As shown, the user can only select dates from March 15, 2025, onwards.

Sample Output1.png

 

 

Disallowing Selection of Past Dates in the Date Picker Field

Capturing the Current Date Using a SET_VAR Block

  1. Add a SET_VAR block before the FORM block where users will select a date from the Date Picker field.

    SET_VAR before FORM.png

  2. Click on the SET_VAR block to edit its properties and select "Create new variable" from the Select Function dropdown.
  3. Under Create new variable, set the Variable type to Datetime and assign a variable name (e.g., CurrentDate).
  4. In the Select date dropdown, choose "Current Date" to capture the system's current date.

 

Using the SET_VAR Value to Impose a Minimum Date

  1. Select the FORM block where users will select a date.
  2. Add a route from the SET_VAR block to the FORM block.

    SET_VAR to FORM.png

  3. Click "Open Form Builder."
  4. Add a DATE PICKER field to the form.
  5. In the Property Editor, navigate to the Field Validation section.
  6. Select the "By date variable" radio button.
  7. Under Optional minimum date, enter the variable name assigned in the SET_VAR block (CurrentDate).

    DATE configuration.png

 

Output Preview from Test Run

Below is the result when the user attempts to select a date while the current date is March 4, 2025.
As shown, the user can only select dates from the current date onwards.

Sample Output2.png

 

 

Automatic Calculation of Deadline Based on Assessment Creation Date

Capturing the Assessment Creation Date Using the SET_VAR Block

  1. Add a SET_VAR block before the user intake FORM block.

    SET_VAR before FORM.png

  2. Click on the SET_VAR block to edit its properties.
  3. In the Select Function dropdown, choose "Create new variable".
  4. Under Create new variable:
    • Set the Variable type to Datetime.
    • Assign a variable name (e.g., CurrentDate).
  5. In the Select date dropdown, choose "Current Date" to capture the system’s current date.

 

Using the DATE_CALC Block to Set the Deadline Date

  1. Add a DATE_CALC block and create a route from the SET_VAR block to it.

    DATE_CALC from SET_VAR.png

  2. Click on the DATE_CALC block to edit its properties and select "Add time period to date" from the Select Function dropdown.
  3. In the Add time period of field, enter the required number of days, and select "Days" in the Select unit of time dropdown. For example, if the user needs to complete the assessment within 30 days, input 30 as the time period and days as the unit of time.
  4. In the Select date variable field, choose the variable that holds the current date (e.g., CurrentDate).
  5. Select the preferred date format from the Format Date as dropdown.

    Assessment Deadline.png

 

Output Preview from Test Run

When previewing the AssessmentDeadline variable value in the FORM, we can see that the assigned deadline is April 3, 2025, for an assessment created on March 4, 2025 (30 days after the creation date).


Sample Output3.png