DataNodes Block
Introduction
The DataNodes block, a key component within the Sequencer module, serves as a powerful tool for translating dynamic message event data into structured, navigable data formats, such as trees or lists. This transformation is fundamental in scenarios where event-driven data needs to be organized, visualized, and interacted with in a coherent and user-friendly manner.
Usage
DataNodes is primarily employed to handle and organize complex data structures dynamically within a CDP application. Its key functionalities include:
- Creation: It allows for the construction of hierarchical or flat data nodes, building a structured framework from incoming data streams.
- Updating: DataNodes can update existing nodes with new information as it becomes available, ensuring that the data structure stays current and relevant.
- Deletion: It offers the capability to remove nodes that are no longer needed, maintaining the cleanliness and efficiency of the data structure.
This approach enables applications to not only display data in a user-friendly and navigable format but also react to changes in real-time. Whether it's reflecting updates from a live data feed, user interactions, or other sources, DataNodes ensures that the data structure remains dynamic, responsive, and reflective of the current state of information.
Configuration
Configuring the DataNodes block involves setting property values for node management and configuring event properties to suit specific operational requirements. This process tailors the block's behavior to fit the dynamic data handling needs of a CDP application:
- Property Configuration: Adjusting properties like NodeUnique, NodeValues to define how nodes are structured, displayed, and maintained.
- Event Configuration: Setting up events such as Init, Add, Update, and Remove to determine how the block reacts to different operations, thereby managing the lifecycle of data nodes within the application.
Through this configuration, DataNodes can be finely tuned to reflect the structure and behavior desired for the data it manages, ensuring that it aligns with the specific use case and interaction patterns of the application.
Properties
Property | Description |
---|---|
NodeUnique | Defines unique names for data nodes based on child argument values. |
LevelSeparators | Characters in NodeUnique values for creating tree structure levels. |
NodeValues | Child arguments represented as values on data nodes. |
ReaddUpdates | Determines if re-adding a node updates it or adds a new unique node. |
Events
Event | Description |
---|---|
Init | Initializes DataNodes, removing all current data nodes. |
Add | Adds a new node or updates an existing one if ReaddUpdates is true. |
Update | Updates an existing data node with new values. |
Remove | Removes an existing data node. |
Use Case: Displaying Database Query Results
Scenario
Consider a database with customer information that you want to display in a UI. The database holds details like names, emails, and purchase histories. The goal is to create an interface for selecting customers to view their details.
Solution
Use the DataNodes block to dynamically represent customer data. Each customer's information forms a separate node. As customers are added or updated in the database, DataNodes reflects these changes in real-time.
The DBQuery block fetches data from the database. For each query execution, DBQuery's Row
event sends data to DataNodes' Add
event for node population.
Integration with NodeTable and NodeList Widgets
NodeTable and NodeList widgets in the CDP framework visualize data nodes from DataNodes. These widgets automatically reflect DataNodes' structure, offering a dynamic UI.
Workflow
- DBQuery executes a SQL query for customer data.
- Each fetched row emits DBQuery's
Row
event. Row
event data is sent to DataNodes'Add
event for node updates.- NodeTable or NodeList widgets connected to DataNodes update to show the current customer data node structure.
- Users interact with these widgets for detailed customer information.
Benefits
This use case combines DataNodes' dynamic data handling with the visualization capabilities of CDP's NodeTable and NodeList widgets. It offers an efficient, user-friendly way to manage and display data structures in real-time, enhancing CDP applications' interactivity and responsiveness.
See also EventIn, EventOut, and Service Blocks.
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.