The Date Calculator action allows dates or periods between dates to be calculated in workflows. The Date Calculator action is discussed in more detail below.
Table of Contents
- Understanding the Date Calculator Action
- Setting Up a Date Calculator Action
- How a Date Calculator Action Appears in the User Application
Understanding the Date Calculator Action
The Date Calculator action allows new dates or time periods to be calculated based on either specific dates, times, a combination of dates and times, or other information stored in Square Brackets defined earlier in the workflow.
To calculate a date, a value is either added to or subtracted from a specific date. Calculated dates are returned in formats such as dd/mm/yyyy. For example, a start date of 01/6/2020 and a period of 30 days will return 01/07/2020 (dates are in DD/MM/YYYY format).
To calculate a period, the Action calculates the difference between two dates, with the return value dependent on the specified period, e.g. days, weeks, months, and years. For example, again using DD/MM/YYYY format, a start date of 01/6/2020 and an end date of 01/7/2019 will return 30 days, if the return value is set to days, or 1 month, if return value is set to months.
The Date Calculator action is suitable for calculating renewal dates, periods to determine if someone qualifies or ages for example. In this regard, it is often used in combination with a Form action that has Date, Time, or Date and Time questions.
The result of a Date Calculator action is stored within a Square Bracket, making the information available for later use.
Setting Up a Date Calculator Action
A Date Calculator action is used where some future date or a time period needs to be calculated.
To set up a Date Calculator action:
- Drag a Date Calculator action to the canvas of the Workflow Editor, and connect it to the prior action in the workflow.
- Position your cursor over the action, then click the Edit icon when it appears.
- On the Action Editor, select the type of calculation to be performed by the action. If some future date will be calculated based on the number of days from the start date, select Calculate Date. If a period will be calculated based on specified start and end dates, select Calculate Period.
To see how a date is calculated, see To Calculate a Date.
To see how a period is calculated, see To Calculate a Period.
To Calculate a Date
To calculate a date with a Date Calculator action:
- On the Action Editor, select Calculate Date.
- For the Start Date, you may select from a Square Bracket, a specific date using the Calendar, or the current date, or the date at the time the workflow is run.
- Select either the Add or Subtract operator.
- Under Period, select a Square Bracket and the applicable period (days, weeks, months, or years).
- Enter a name for the Square Bracket. This will be used to store the calculated date.
- Click Advanced Options, check whether to include the Start and/or End Dates in calculating period. By default, End Date is always included, but you may exclude it if required.
- Click the x button on the top-left to save your changes and close the Action Editor.
To Calculate a Period
To calculate a period with a Date Calculator action:
- On the Action Editor, select Calculate Period.
- For both the Start and End Dates, you may select from a Square Bracket, a specific date using the Calendar, or the current date (the date at the time the workflow is run).
- Enter a name for the Square Bracket. This will be used to store the calculated period.
- Click Advanced Options, select the period units (days, weeks, months, or years), the number of decimal places to be used, and check whether to include the Start and/or End Dates in calculating period. By default, End Date is always included, but you may exclude it if required.
- Click the x button on the top-left to save your changes and close the Action Editor.
NOTE: Under Advanced Options, if Start Date is included in calculating the period, the period 01/01/2020 to 08/01/2020 (in DD/MM/YYYY format) will be eight (8) days. If only End Date is included in the calculation, the period will be seven (7) days. If both the Start and End Dates are excluded, the period will be six (6) days only.
How a Date Calculator Action Appears in the User Application
The Date Calculator action does its calculations behind the scenes - it does not show how it arrives at the calculated dates/periods.
To display the calculations that the Date Calculator action performs, you may add a Page and/or Email action right after the Date Calculator action. These actions need to:
- call the square bracket defined in the Date Calculator action
- call other square brackets that may have been defined in prior actions, as needed
- Or you could use the calculated square bracket to branch the workflow in a condition
In the image below, a calculated date is displayed on a Page action in the User Application.
The image below shows a calculated period on a Page action in the User Application.
Comments
0 comments
Article is closed for comments.