- 21 Jul 2022
- 3 Minutes to read
-
Print
-
DarkLight
Building and Using Converter Flows
- Updated on 21 Jul 2022
- 3 Minutes to read
-
Print
-
DarkLight
Overview
A Converter Flow is a Flow Behavior that can convert Input Data from one Data Type into another. Using a Converter Flow can be used to clean up data that can be handled more elegantly within a process or displayed as desired.
Default Converter Flows
The default Converter Flows are displayed in the table below. These options can be found by navigating to System > Designers > Catalog > System Defaults > Converter Flows.
Converter Flow | Function |
---|---|
Convert String to Bool | Converts String input to Boolean output |
Convert String to Byte Array | Converts String input to ByteArray output |
Convert String to Date | Converts String input to Date output |
Convert String to Decimal | Converts String input to Decimal output |
Convert String to Int32 | Converts String input to Int32 output |
Convert String to Int64 | Converts String input to Int64 output |
Get Unique Strings from List | Searches List input for duplicate String inputs |
Merge String List to Single String | Converts a list of Strings into a single String |
Set Decimal Places on Number | Collects number values in a String input and then adds a specified number of decimal places |
Trim String Flow | Shortens the String input to a specified length |
Optimizing Converter Flows
Converter Flows can be optimized by caching their outcomes. This can be done by navigating to the Properties panel for the Flow and expanding the Outcomes header.
From here, users can configure the Cache Outcomes for the Flow, though there are some limitations:
- If the Converter Flow fetches from a database, the values must match the input values to the Flow.
- If the Converter Flow fetches data through an API call, the values must match the input values to the Flow.
For example, if the Converter Flow fetches a string input and its value matches the input to the Flow, then caching can be used. The only major change can be the data types between the two values.
Building a Converter Flow
The following example will demonstrate how to use a Converter Flow to convert a String into a DateTime value.
- From a Designer Project, select the CREATE FLOW button. Then, CREATE a new Converter Flow by selecting Converter Flow under the Converters category.
- In the Flow Designer, attach a Parse Date step from the Toolbox panel by navigating to DATA > DATES to the Start and End steps.
- Select the Start step. Under the FLOW INPUTS category, click SHOW EDITOR under the Flow Input Data field.
- From the Flow Inputs window, enter "DateAsString" and select String [Text] from TYPE. Click Save and close the window.
- Select the Parse Date step and on the Properties panel, map DateAsString to the Date field.
- Select the End step. Click SHOW EDITOR under Output.
- From the Output Data window, enter "ParsedDate" under NAME and select Date Time as the TYPE. Click the pencil icon under INPUT and map it to ParseDate1_Output. Click Save and close the window.
- Click Save and close the Flow Designer.
Running a Converter Flow
- In a Designer Project, CREATE a new Flow.
- From the Flow Designer, attach a Show Form step from the FAVORITE STEPS category to the Start step. Select PICK OR CREATE FORM from its Properties and create a new Form.
- Configure the Form with a Date Time Picker (StringDataPicker) and a Button. Click Save and close the Form.
- Back in the Flow Designer, from the Properties of the Show Form step, under INPUTS, configure the mapping for the String Data Picker field to the previously created Converter Flow by clicking Unknown >Converters > [Name of the Converter Flow] from the mapping options.
- After the Converter is applied to the Input, locate the Converter Flow's Input under EDIT CONVERTER and enter "10/11/2022". Acceptable DateTime formatsare formats that can be utlized in C#.
- Connect the Done path to the End step. Click Save to save changes to the Flow.
- Click Debug on the top action bar. Click START DEBUGGING.
- When the Flow reaches the Form, either use the previously defined String value or select a new one via the Date Time Picker, then click Done.
- After the debugger runs, select the Form step, select Execution 1, and click View Input/Output Data.