This question came up already about datetime so I’d like to document it here.
The use case is prompt the user for a date, then branch depending on before or after that date.
The first thing is to follow the instructions to add the datetime module to your solution. We show that here: https://www.teneo.ai/studio/extensions/datetimehandler
You can build this in four basic steps resulting in something like this for a branch on dates before Jan 1, 2000.
The prompt and branch:
The transition listener:
The flow variables:
These steps describe more in detail what you have to do:
In the output that prompts for the date, you have one leaving transition with the condition
%DT_DATE.PHR. The transition ends at a junction.
In the same transition you define a listener to get the date expression out of the input.
In the condition field:
- The listener’s script should intepret the date:
interpretedDate = datetime.Handler.interpret(dateExpression, 'forward') simplifiedDate = interpretedDate.date.start
- At the branch you can use the groovy function isBefore() to compare the entered date to a constant you define (cutoffDate).