- 27 Jul 2022
- 3 Minutes to read
- Print
- DarkLight
Building and Using Converter Flows
- Updated on 27 Jul 2022
- 3 Minutes to read
- Print
- DarkLight
Overview
Converter flows are designed to convert data of one data type into another (for example, a string into a DateTime). In most cases, using a converter flow is unnecessary; 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.
Default Converter Flows
The default Converter Flows included with Decisions are listed below. They are found under System > Designers > Catalog > System Defaults > Converter Flows. Users can also create their own Converter Flow, as shown in the following example.
Converter Flow | Function | Input | Output |
---|---|---|---|
Convert String to Bool | Converts String input to Boolean output | String | Converted Boolean |
Convert String to Byte Array | Converts String input to ByteArray output | String | ByteArray |
Convert String to Date | Converts String input to Date output | String | Converted Date |
Convert String to Decimal | Converts String input to Decimal output | String | Converted Decimal |
Convert String to Int32 | Converts String input to Int32 output | String | Converted Int32 |
Convert String to Int64 | Converts String input to Int64 output | String | Converted Int64 |
Get Unique Strings from List | Searches List input for duplicate String inputs | List | List |
Merge String List to Single String | Combines Lists of Strings input to a single list of Strings | List of Strings and Separating Character | Merge List of Strings |
Set Decimal Places on Number | Collects number values in a String input and then adds a specified number of decimal places | String to Truncate and Number of Decimal Places | String Truncated |
Trim String Flow | Shortens the String input to a specified length | Untrimmed String | Trimmed String |
Example
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.
In versions 6.19+, the resulting Converter options will be listed alphabetically to make it easier to locate a specific.
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.