How to add a number of days to a date
- To set this up you will need access to the Raw JSON editor
- If you don’t have access to this feature, please your system administrator or email us at connect@rise-x.io
- For this functionality we will be using the data pipelines functionality
What are data pipelines?
- These are automatic operations that run in the background while work it happening
- In this case an operation will run and take one date, add a number of days to it, then automatically populate another date component with this new date
Step by step guide
- Go into the advanced editor properties panel then swap to raw json
- Scroll all the way to the bottom and find the “dataPipelines”: [] property
- Create a new data pipeline in the raw json properties panel
- You can create a new data pipeline by typing in {} into the square brackets then let it auto save and pre-populate some of the data pipeline
- Add “name” directly underneath the first “id” property
- If
- “stepType” defines what the type of operation is
- For this example it should be “WORK_DATA_PATH_EXISTS”
- Need to add a dataPath in the payload (this should be the original date component dataPath)
- Then
- Need to add in {} into the square brackets first and then let it autosave and it gives it a unique id automatically
- Add in “stepType” property underneath “id” and set the value to “ADD_DAYS”
- Add in “payload”: {} property underneath “stepType”
- Add in “fromDataPath”: “”, and “toDataPath”: “”, and “numDays”: “” into the payload
- Set “fromDataPath” value to be the dataPath of the original date component
- Set “toDataPath” value to be the dataPath of the date which will have the added days
- Set “numDays” to be the number of days to add (e.g. “60”)
- Then you need to add in another {} after the “ADD_DAYS” part because you need to add another step type
- Add in “stepType” property underneath “id” and set the value to “TRY_SAVE_DATA”
- Add in “payload”: {} property underneath “stepType”
- Add in “jsonPath”: “”, and “sectionName”: “”, and “withCalculate”: false
- Set “jsonPath” value to be the same as the “toDataPath” value
- Set “sectionName” value to be the task name of the task that the “toDataPath” dataPath sits on
- You can find the task name by navigating to the task in the advanced editor and then copying the value from the “name” property
- Set “withCalculate”: false (don’t include “” around false)
- Then can add another step type (“TRY_SAVE_DATA”)
- The “watchPaths” is what it is watching for to change so that the calculation runs when’s the data path changes
- So for this example you would put in the original date dataPath in quotation marks
- e.g. “watchPaths”[
- “$.task.dateOriginal”
- ]
- Done! You can now publish the workflow and when you enter a date into the original date component the other date component should then show the original date + 14 days
Example from raw json in the properties tab
"dataPipelines": [
{
"id": "505d17b4-fff6-43e0-ae94-d17a26f440a3",
"if": {
"id": "09e9070e-3df5-40b6-aa6a-258bab3ebbae",
"stepType": "WORK_DATA_PATH_EXISTS",
"payload": {
"dataPath": "$.task.originalDate"
}
},
"then": [
{
"id": "09e9070e-3df5-40b6-aa6a-258bab3ebbaf",
"stepType": "ADD_DAYS",
"payload": {
"fromDataPath": "$.task.originalDate",
"toDataPath": "$.task.date14Days",
"numDays": "14"
}
},
{
"id": "09e9070e-3df5-40b6-aa6a-258bab3ebbag",
"stepType": "TRY_SAVE_DATA",
"payload": {
"jsonPath": {
"jsonPath": "$.task.date14Days",
"sectionName": "UntitledTask/Generated-a773f114-1b71-4c71-9114-e2865b8f61b8",
"withCalculate": false
}
}
}
],
"else": [],
"watchPaths": [
"$.task.originalDate"
]
}
],