Building and Using Converter Flows
- Updated On 22 Oct 2020
- 2 Minutes To Read
Converter flows are designed to convert data of one data type into another data type (for example, a string into a DateTime). In most cases, using a converter flow is not necessary; there is almost always a way to use the data you need in its original state without converting it. However, using a converter flow can be helpful in cleaning up data so it can be handled more elegantly in the process, or displayed exactly how you want.
Converter flows are regular flows that have had their flow behavior set to function in this way. For information on how to set flow behavior, see About Flow Behaviors.
There are many default Converter Flows included with Decisions. They are found under System > Designers > Catalog > System Defaults > Converter Flows. Users can also create their own Converter Flow.
This example will run a converter flow to change a string into a DateTime. Create a date as a string then use a converter flow to convert the string into a DateTime with the right format. Below is a downloadable example to import into Decisions.
Start in a Designer Folder by creating the converter flow. Select Create Flow, choose Flow [Converter]. Name and create the flow. This flow will already be set with the Converter Flow behavior.
Configure this flow with a Parse Date With Format step, in the Steps tab on the right under Data > Dates.
For the Start step, in the Properties panel on the right under Data Definitions, create a string object called DateAsString and configure the input and output settings as follows.
For the Parse Date With Format step, configure the inputs and outputs as follows.
On the End step add an Output. Name this output "Date" with the Type DateTime. Choose the output from the Parse Date with Format step to the Date input on the End Step.
Save and close the flow.
Back in the Designer Folder, create a default flow called Using a Converter Flow.
Add a Show Form step (in the Steps tab on the right under Favorite Steps) and configure it with a Date Time Picker and a Button.
The Date Time Picker control is configured as follows.
Save and close the form.
In the Flow Designer, in the Properties panel on the right under Inputs, configure the mapping type for "Date" as Run Converter, then pick the converter flow that was just created.
To test the flow, select Debug in the top bar, then select the play arrow to launch the flow. The form will display with the converted date.
Remember, this is the date originally defined as a string with an odd format:
As it is now displayed in the form, it is a DateTime data type and in the correct format.