Using a Flow to Create Dynamic Objects at Runtime
  • 03 Dec 2021
  • 1 Minute to read
  • Dark
    Light

Using a Flow to Create Dynamic Objects at Runtime

  • Dark
    Light

Article summary

Example Lab Article
While Example Lab projects are resources for public use, articles and assets are not actively maintained. Screenshots and features are from the specified version below. These references may become dated as new versions are released.

Overview

Example Lab Details

Version7.8.0.6420
Root FolderDynamicObjectCreation
Modules None
DependenciesFive: BuildXMLString [Flow], History Folder of Main Process Folder, Adjust Data Flow [Flow], Object [System], FetchRandomDynamicData [Flow]

This Example Lab demonstrates how to create Dynamic Objects at Runtime through the use of a Flow. 


Explanation

The following example utilizes a three Sub Flow system to dynamically create Decisions Objects at Runtime that can be then Serialized into an XML String. These serialized Objects can then be used by a third-party application for additional functionality. 

Note on Example
Before proceeding to the Main Flow, open and run the Populate Mock DB Data to create some sample data for use by the Main Flow. 

The Flow achieves this by utilizing a Create Data step to create an Object List (DynamicListBuilder); this serves as the Object generated by the Flow. 

The Flow then generates a Random Integer to determine which List of Employee information (Person, Document, and Employee data) is Fetched. The data for this Object is then iterated through a ForEach Step loop that assigns a Random First Name for each Object (via Adjust Data Flow). 

Lastly, the DynamicListBuilder data is sent through a ForEach Step loop that casts the Object data to their respective Data Types, each one of which is sent to a separate XML Serialize step to convert them into XML values. These values are cleaned up through the use of Replace Text steps for final use with the Close String Builder steps; these steps are used to compile the XML values into a single String for final Output

Reference Articles



Project Download

The examples attached were developed to be instructional and were not developed as officially supported components. For more information or to engage our service team to develop fully supported, production quality solutions, please contact services@decisions.com. Import the project below to a Decisions environment on version 7.8.0.6420 or later using our Importing/Exporting article.





Was this article helpful?