Apply Operators on Sub Node of a Cluster
There are scenarios where we need to handle clustered data. One reason could be that the actual data is clustered. Another may be that we deal with a Web Service, and the meaningful data appears as a sub-node under the root. Either way, we may need to operate on a sub-node of the cluster – data that is not in the root. For example: Filter that data.
Consider the following example, where we model Table Views in the defined clustered hierarchy:
The application may look like this:
Now, assume that we want to filter the data on the address level, for example: the address of the currently selected supplier.
Here is the same application, only now we filter out address records where the country equals china. Notice the supplier Oy has one address less than before.
In the current model, we show the suppliers in the first Grid View, where the Context Node is supplier_list. Any operator we connect after this Grid View could operate on fields of this node alone.
We need to somehow get the address list for a selected supplier, so we can pass it to the operator. A dedicated Service Component can do just that: The input port gets the hierarchy of selected supplier with the addresses sub-node. The output returns the flat list of addresses:
Here are the required modeling steps:
1. Add a Service Component to the model.
Model the Service Component:
2. Add a Data In element. In the Define Data dialog set it to contain the full supplier hierarchy. Set the root Cardinality to 1..1 (use the View => Hierarchy Tree option to define the clustered data).
3. Add a Data Out element. In Define Data set the same hierarchy minus the original root.
4. Define the mapping to copy the rows from the source sub-node to the target root:
For this type of “sub-node to root” mapping, we need to have at least one difference between source and target fields, so we get the diamond shape on the mapping link.
Back in the main model:
5. Open the Redefine Ports dialog for the new Service Component and select the new ports.
6. Connect the new service to model elements.
7. It is now possible to define the desired filter on the address level:
That’s all
Other cluster related documents:
Multiple rows for a selection criteria – the Cluster way
Visual Composer Modeling UI Modeling with Clustered Data
And videos:
Guard Condition on Nodes – SAP Visual Composer | Facebook
Multilevel Controls – SAP Visual Composer | Facebook
Skip cluster nodes in the UI modeling – SAP Visual Composer | Facebook
Hi Udi,
at first: great documentation, works perfectly!
What i found out which works aswell is to put a table as output of the webservice and change the context to the subnode of the cluster (see picture below)
Afterwards you can put a filter behind the ouput of the table and filter data by root.
Regards,
Maurice
Hi Maurice,
I agree, good point! 🙂
I show the general way with no UI, as maybe we want no UI elements in the flow until after the operator.
Thanks,
Udi