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