Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

How to process structured streams using the Map Structured rule

Updated on September 10, 2021

Summary

Structured streams can be processed by using the Map Structured rule. Processing can be done two ways within an existing flow rule:

  1. 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".
  2. 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.

 

Suggested Approach

To Parse a stream into multiple properties:

  1. Create a new Map Structured rule by clicking the Application tool bar item and navigating to New > Rule > Integration-Mapping > Map Structured.
    New
  2. Complete the new rule dialog window. Specify the Purpose and select a RuleSet to save to.
    New Rule Window
  3. 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.
    form

    SettingsCharacter EncodingThe character encoding used when the "Map From Clipboard" is used in the Map-Structured activity method.JustificationSpecifies which side of the property the padding characters should be added to, Right or Left.Default Pad CharacterThe default padding character to be used, Space or Other.Specify Pad CharacterIf 'Other' is chosen as the Default Pad Character, specify it in this field.Map FormatOffsetThe number of spaces from the Left side that the mapping should start.LengthThe length of the mapping.PropertyThe property or properties that should be mapped to or from, based on the Direction specified in the Map-Structured activity method. Pad CharacterOverrides the Pad Character defined in the Settings section.JustificationOverrides the Justification setting defined in the Settings section. -->
  4. 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.
    activity
    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.
  5. Add a utility shape to your flow rule that references the activity rule created in step 4.
  6. When the Purchase Order process is run, the Order Date field is already populated with the time at which the Purchase Order was created.
    Order Date
  7. The result of the mapping can be seen on the clipboard as well as on the work object.
    DateResult

To Construct a property from two input streams:

  1. Create a new Map Structured rule using the process described above. The Map Structured rule is called MapDept in this example.
  2. This example combines two existing properties (.DeptName and .DeptNumber).
    ID Map

    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.
  3. 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.
    ID Activity
    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.
  4. Add a utility shape to your flow rule which references the activity rule created in step 3.
  5. In this example, when the Purchase Order process is run, the Department Name is chosen and and the Department Number is entered.
    new ID

    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.
    Clipboard

    Department

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us