How to process structured streams using the Map Structured rule
Structured streams can be processed by using the Map Structured rule. Processing can be done two ways within an existing flow rule:
- Parse — The input stream is split into two separate streams that can then be saved to designated properties. For example, the Map Structured rule can be used within a Purchase Order application to parse an .OrderDate property into separate .Date and .Time properties which can be displayed in a message, such as "Your order was submitted 12/12/2008 at 10:47am".
- Construct — Two input streams contained in properties are combined into a single output stream. For example, in the Purchase Request application, the user must first select their Department Name and enter their Department Number. These two fields can be used to construct a single .Department property that contains both pieces of information.
Previously, these operations were carried out using either Java steps in an activity or the Structured Parse rule.
To Parse a stream into multiple properties:
- Create a new Map Structured rule by clicking the Application tool bar item and navigating to New > Rule > Integration-Mapping > Map Structured.
- Complete the new rule dialog window. Specify the Purpose and select a RuleSet to save to.
- This example parses a standard DateTime property into separate .Date and .Time properties, which must be defined. Complete the Map Structured rule form. Set the Offset (the number of characters in the stream after which mapping will start) and Length (the number of characters to be mapped). The Map Structured rule is saved as DateParse.
Settings Character Encoding The character encoding used when the "Map From Clipboard" is used in the Map-Structured activity method. Justification Specifies which side of the property the padding characters should be added to, Right or Left. Default Pad Character The default padding character to be used, Space or Other. Specify Pad Character If 'Other' is chosen as the Default Pad Character, specify it in this field. Map Format Offset The number of spaces from the Left side that the mapping should start. Length The length of the mapping. Property The property or properties that should be mapped to or from, based on the Direction specified in the Map-Structured activity method. Pad Character Overrides the Pad Character defined in the Settings section. --> Justification Overrides the Justification setting defined in the Settings section.
- Define a single-step activity in the same class as the Map Structured rule. Specify the Map-Structured Method. This activity will later be referenced from a utility shape in the flow rule.
Complete the following parameters:
- Direction — Choose "Map To Clipboard" to parse the input stream into the properties defined in the Map Structured rule.
- Map — Specify the Map Structured rule you created for this application. In this example, the Map Structured rule is named DateParse
- Property — Enter the property to be parsed into two separate properties, .OrderDate in this example.
- Add a utility shape to your flow rule that references the activity rule created in step 4.
- When the Purchase Order process is run, the Order Date field is already populated with the time at which the Purchase Order was created.
- The result of the mapping can be seen on the clipboard as well as on the work object.
To Construct a property from two input streams:
- Create a new Map Structured rule using the process described above. The Map Structured rule is called MapDept in this example.
- This example combines two existing properties (.DeptName and .DeptNumber).
The .DeptName property contains a list of two character department names. However, it will be helpful to insert a hyphen character in between the department name and department number portions of the .Dept property. This is accomplished by setting the Length to 3 characters and specifying a hyphen as the pad character. A Pad Character specified for an individual property overrides the Default Pad Character.
- Define a single-step activity in the same class as the Map Structured rule. Specify the Map-Structured Method. This activity will later be referenced from a utility shape in the flow.
Complete the following parameters:
- Direction — Choose "Map From Clipboard" to construct the input streams listed in the Map Structured rule into a new property defined below.
- Map — Specify the Map Structured rule you created for this application. In this example, the Map Structured rule is named MapDept.
- Property — Enter the property to hold the result of the construction.
- Add a utility shape to your flow rule which references the activity rule created in step 3.
- In this example, when the Purchase Order process is run, the Department Name is chosen and and the Department Number is entered.
After the utility shape is passed, the new .Dept property is placed on to the clipboard and can be used in the application user interface.