- 07 Jul 2022
- 9 Minutes to read
Input and Output Mapping Type Overview
- Updated on 07 Jul 2022
- 9 Minutes to read
In Decisions, data moves through a Flow by passing in and out of Flow steps. Data passing into a step, or data that is used on a step before processing, is referred to as its Input data. This data is used to configure the step's Properties and defines how the Flow continues. Flow steps use those inputs to complete the intended function, then pass the manipulated data out and on to the next step. Once the data leaves a step, it is known as its Output data.
The action of applying data to a step is known as mapping; in turn, the method by which data is mapped to a step is known as its Mapping Type. Depending on the Mapping Type selected, data may be defined from the step itself, or maybe broken down into its individual Properties, which then can be mapped to separately.
The following article discusses the different Mapping Types that are used to appropriately define a step's Input data.
General Usage Tips
In the Flow Designer, selecting a step icon will populate the Properties tab with step configurations. Steps are typically set up to receive data as inputs, process the data based on the step function, then sends the data as outputs. Almost all steps have some sort of input data, but not all steps pass output data.
The default input mapping type is always set to Unknown, which is not useable for input values at runtime. The box below each input name prompts the user to type in a value/variable or to pick something from the list of provided data that the step can access. Selecting the Unknown mapping type will reveal the list of other mapping types, which are explored in the sections to come.
Input Mapping Types
The Constant mapping type assigns a continuous user-defined value to an input. The Constant mapping type will provide a data box that corresponds with the input data type for the user definition of the value. For example, the Show Popup step below expects a String input for "Subject" and "Message", selecting Constant for these values will present a text box for string entry. One thing to note with this mapping type is that the value will remain consistent whenever the step is reached at runtime, this is good to have noted for testing purposes in large-scale applications.
When the Flow below is being debugged, the constant string values applied to the inputs of the Show Popup step appear in the popup as expected.
Select From Flow
The Select From Flow mapping type is the most popular selection for defining input data because it can access all available data within the Flow itself. If the data selected has additional properties, they will be available for selection in defining the input as well.
In the GIF below, Subject String and Message String were configured as Flow Input Data. Choosing Select From Flow in the list or using the Pick button will show a window where the available data can be selected for defining the input.
Null & Ignore
The Null and Ignore mapping types are often mistaken for having the same function. The difference between the two is that Null actually defines the input with a null value in Decisions and in the database, whereas Ignore will disregard the input value entirely. It is important to note that most steps will return an exception for unexpectedly null or ignored values.
In the GIF below, a Form is referenced in the Flow that receives two string inputs. In the Flow, the Null mapping type is used for First String and the Ignore mapping type is used for Second String. When the Flow is debugged and the Form is submitted without user-defined values, the debugger reveals that First String was recorded as "null" while Second String was not recorded at all.
Converters & Run Converter Flow
The Converters section of the mapping type menu works in tandem with the Run Converter Flow mapping type. Hovering the cursor over the Converters section of the mapping type menu will show an expanded list of pre-built converters that come with Decisions. Selecting one of these converters will automatically assign the Run Converter Flow mapping type. If a custom Flow has been created to use as a Converter Flow, it can be selected by choosing the Run Converter Flow initially.
In the GIF below, a string list of movie genres is set as input data for the Flow and a Show Form step is expecting to receive a string (non-list) input value. The Converters section is expanded in the mapping type menu of the Show Form input and Merge String List To Single String is selected. When this happens, two new inputs appear. The movie genres list was selected to define the List Of Strings and a comma with a space separator was defined as a constant value for Separating Character. At runtime, that selected Converter Flow takes the list input and converts it to a single string as expected, which is shown on the Form.
Merge HTML/Plain Text
The Merge HTML Text and Merge Plain Text mapping types have the same essential function. They both provide an editor where custom text can be combined with data from the Flow to relay text with specific detail. The difference between the two is that the HTML editor allows for styling edits of the text, whereas the Plain editor only deals with plain text.
In the GIF below, the Merge HTML Text mapping type is used to define the subject of a Show Popup step. In the editor, the text is entered and styled with an increase in font size to indicate that the current email address will be shown.
The Merge Plain Text mapping type is used to define the message of the step. Text is entered into the editor, but the current user email needs to be defined with Flow Data. To do this, the Flow Data section was expanded on the left side. Hovering the cursor over a piece of data on the left side of this window will show a plus that can be used to add the data value to the editor.
These data values can simply be typed and recognized in the editor, similar to how a query is written in database software.
Constant Date/Constant Date and Time
The Constant Data and Constant Date and Time mapping types are available in replace of Constant when dealing with DateTime values in Decisions. Use this mapping type to define a date or date and time that will constantly be used as the value. In the screenshot below, the Show Form step is configured to always show the constant date for the related values.
Current Date Time
The Current Date Time mapping type shows the date and time as of the moment the input is reached on the step in the Flow. In the GIF below, this mapping type is used to populate a DateTime Form component. The time that is shown is the time reflected after the debugging button was initiated and the Flow kicked off.
The Compute Date mapping type gives some input configuration options for computing a date and time in the future or in the past, based on the defined offset of time. When this mapping type is used, a Compute Type dropdown appears with an option for InFuture or InPast. Either option must have the Start and Offset inputs configured. If the Start is set for the current date/time and the Offset is one day, the computed date/time should be exactly one day from the date/time of when the input was reached in the Flow.
The Build Data mapping type becomes available to use when the properties of a data structure must be built manually. Using this option on an input expecting an object of a certain data type will allow the user to expand the properties of that object and manually map them to input definitions. In the example below, a Show Form step receives name, email, and position to create an object of the BasicProfile data structure. On the Create Data step, the Build Data option is used in the mapping editor to expose the properties of a BasicProfile object and is mapped accordingly with the Form outputs. When the Flow is debugged, the entry from the Form is recorded and successfully compiled into an object of the BasicProfile type.
The Build Array mapping type works similar to Build Data except that it only applies to inputs that are expecting a list of something. In the GIF below, two text entries are captured from a Form and sent to the Create Data step, which is expecting a String list called "Customer Cart". The Build Array mapping type is used to add separate items together which compile the array (or list) of String entries.
Output Mapping Types
Output Data from a step always defaults to the Rename mapping type, because essentially any data that is passed in and worked would be expected to pass out as well. The Rename mapping type simply offers the option to rename the modified data so that it can be easily identified when referenced in the Flow. An Add step takes in two values as the input and returns the sum of those values. The output data of the Add step is renamed to Add_Output automatically to indicate the new data value as it will appear in the Flow. This output data could be renamed to something suitable for the project, like "total", and referenced to as such later in the Flow.
If a Flow step is expected to output a composite datatype, the Expose Properties mapping type can reveal all of the individual data members associated with the composite type. Those individual properties will need to have output mapping type options of their own selected.
This mapping type gives a text box to enter the name of the data from the Flow that will be referenced as the value for the specified output. For example, a Show Popup step has Subject and Message inputs; the Message input is set to a constant value of "2". An Add step is configured to calculate the sum of constant values 20 and 50, the output of the Add step is using the Reference mapping type where "Message" is entered into the text box (to reference the Message input on the Show Popup step). When the Flow runs, despite 20 and 50 being the intended values to add, the output of this step shows "2", since that is the data that was referenced.
This mapping type is similar to Rename in that it exists only to pass the data through with the same name, instead of creating a new piece of Flow data that can be used.
Ignore, Run Converter, and Converters
These mapping types operate in the same fashion as they do for inputs, where the value of the output is either ignored or converted with a Flow as covered in the descriptions in the first section.