eBiss 3

Hilfe & Dokumentation

User Tools

Site Tools


Sidebar

en:howtos:buildhierarchwithsplittoarray

Build a hierarchy using function SplitToArray()

To derive a hierarchy from a given structure there is ideally a parent-child relationship of the individual tuples. In such a case, the function BuildHierarchy can be used to create the hierarchy.

If a direct parent-child relationship is only possible via the sequence of tuples and unique parent or child characteristics1), the following approach can be chosen:

Solution approach

We use the following functions and components:

  1. Selektionsmodus: concatenate
  2. XPATH Filter

Procedure in Mapping

First we store the tupples all in a $$ Variables with name $$Position to run through them in the next step. We then filter out the tuples by parent or child characteristic to form a string containing the hierarchy2). By cleverly applying the selection mode “concatenate” on the rule sets and controlling the separators3) a string can be formed according to the following pattern:

MainPositionID1,MainPositionID2#SubPositionID1#SubPositionID2,MainPositionID3#SubPositionID1

This hierarchy string can finally be split with SplitToArray and the separator “,” into the main positions, which trigger Positions in the target object and then for sub-items are again individually resolved after the separator “#” into the sub-items, which are triggered in the shown example below Positions as CustomItems in the MiddleWare4).

Note: If the same item numbers are expected to come in different positions, then the original position number must be taken into account when creating the hierarchy!

Advantage

We avoid an intermediate mapping5) which could contain the parent-child relationship.

1)
Similar to the handling of record types in FlatFiles.
2)
In this case we distinguish by the first 3 digits of the item number.
3)
Here “,” as separator for mainPositions and “#” for SubPositions.
4)
Or in the respective target object.
5)
This would be a classic solution with extra mapping.
en/howtos/buildhierarchwithsplittoarray.txt · Last modified: 2024/02/20 08:15 by 127.0.0.1