This article describes a technique for manipulating process or document property values using a Business Rules shape instead of a Map shape.
You may want to manipulate a property value such as incrementing a counter, capturing a last modified date, or conditionally setting a property value without using a Map shape or Data Process custom scripting shape. Custom scripting may not be a viable option if the manipulation requires actions like connector calls or cross reference table lookups.
Using a Map shape is undesirable in some situation including:
- You simply do not need to access any of the document's values so there is no need to parse the data
- The document data/profile is unknown at design time (e.g. additional fields/columns)
- You want to perform this action in a common subprocess that may encounter a variety of profiles
The solution is to take advantage of the Business Rules shape's ability to execute Map Functions. This allows you to get and set properties and perform any operations available to Map Functions. Note you will not be using the Business Rules shape with the intent to validate and route the documents.
- Use the Business Rules shape configured with a "dummy" profile. This means the function cannot access any document data. If you need to, set those values as document properties ahead of the Business Rules shape.
- Add a rule that invokes a User Defined Map Function that performs the desired manipulation.
- The function should be designed to always return a value of "true". This will be used to evaluate the condition and overall Business Rules shape as Accepted.
This example shows how to increment a custom counter stored in a dynamic document property.
- Create a dummy Flat File profile with no elements. This will satisfy the Business Shape's profile configuration but allow the shape to execute with any document data.
- Create the User Defined Map Function that performs the manipulation. The function will not have any Inputs and only a single Output (e.g. "Result"). In this example the function gets a dynamic document property named "MY_COUNTER", adds 1, and sets the same property. Lastly--and importantly--it uses another step to simply output the value "true" by using a String Append step with a default Original Value.
- Add a Business Rules shape referencing the dummy profile.
- Add a Rule and add a Function Input. Choose the function created above. See Adding input fields and functions to a business rule for more information.
- Add a Condition that compares the function result to a Static Value of "true". See Adding conditions to a business rule for more information.
- Skip configuring an Error Message and click OK.
- Connect the Business Rules shape into your process.