Adding Profile as Subnode in Source Structure (Sub Profile)


images/download/thumbnails/44946723/arrow_up-version-1-modificationdate-1583802786012-api-v2.png Introduction: You can find a description of this phase in section Phase 3 (Introduction). See also section Nested and Networked Profiles.


images/download/thumbnails/44946723/image2020-3-18_18-54-59-version-1-modificationdate-1584510898744-api-v2.png

You can use the context menu on a node or field of the target structure to insert an existing profile (its target structure) as a subnode in the source structure (substructure).

Requirements for a Profile to Be Added (Subprofile)


A profile can be added if


Requirements for an Added Profile


A profile can add another profile if


  • it does not use document type XML with the V4 parser.

Adding a Subprofile


A profile can be added via the context menu (→ Add profile as sub node in source tree) of any field and node in the target structure. Another dialogue will appear.


images/download/attachments/44946723/1136-version-2-modificationdate-1663149988582-api-v2.png


(1) Select the profile to be added.

(2) Specify a unique prefix and a node name for the substructure. Note: The prefix ensures that all field/node names in the source structure remain unique, since two included profiles could use an identical field/node name, for example. The prefix has the effect that you get two distinct names prefix1.fieldname and prefix2.fieldname, for example. This also allows you to include the same profile twice.

(3) This will add the profile.

Result


As a result, on the one hand, the function call sub profile for source tree (a,b,c,d,e,f,g,h) is placed on your node/field in the target structure. Parameters a, b and h are set automatically (see there).

On the other hand, you will then see the following substructure in the source structure.


images/download/attachments/44946723/1137-version-2-modificationdate-1663150009907-api-v2.png


(4) The attributes of nodes and fields of the subprofile are locked. However, you can modify them manually if you click on the lock if only minor details in the subprofile have changed. Otherwise, you should use the synchronisation (described below).

(5) If changes have been made to the subprofile, you can synchronise them automatically via the context menu of the node (here sub1.generate_random_number) → Synchronize with profile .

Calling a Subprofile and Data Flow


The substructure is always filled with data with function call sub profile for source tree (a,b,c,d,e,f,g,h). The data always comes from the target tree of the subprofile and not from its Integration Unit, etc.

You can delete fields and nodes in the substructure if you only need a partial view of the data, but you always receive the full data from the subprofile. However, the hierarchical structure of the substructure must be preserved for the parsing to work.

You can fill the substructure with data as often as you like by calling the above function multiple times (at any position). As a result, you will then simply get multiples of the substructure. You can also empty the substructure before the function is executed. In addition, the function can cache the result data and use it when called again, instead of calling the subprofile again. Take a look at the example profiles. The order in which the substructure is filled is how the associated function is called. If a subprofile has not yet been called via the function in the target structure, then the substructure in the source structure also has no data yet.

You can map with this substructure as you are used to. If you are using a path, then please do not place it on sub1.generate_random_number, but on sub1.node_random_number.

Important note: It is the responsibility of the user/developer to avoid endless loops (or to handle them appropriately) when using the subprofile mechanism described here! It is possible, for example, to create a profile 1 that includes profile 2. If you then include profile 1 in profile 2, you will get an endless loop.

Passed Variables (and lists and maps)


The variables of the calling profile are passed to the subprofile. See section Passed Variables, Lists and Maps (Profile Chains and Sub Profiles). There you will also find a description of how to pass lists and maps (and all variables of the calling profile in a map).

1:1 Mapping


In a 1:1 mapping, the substructure is not transferred.

Hierarchical Structures


As you may have noticed, the included profiles in the source structure are all 'flat'. Although they have nestings in themselves, you cannot insert a profile 1 first and then a profile 2 into profile 1. Nestings of this kind, i.e. the construction of a hierarchical overall structure, are achieved through mapping and the hierarchical structuring of the target structure. And these methods are all familiar to you from 'normal' mappings. Specifically, the data from profile 2 can be inserted below/inside the data from profile 1 in the target structure.

Application Example


Let's assume profile 2 gets a number of items in an order. You could then go through the articles in the target structure, like you already know from 'normal' mappings, and call a profile 1 (included in the source structure), which provides you with additional information about the respective article (the current price, the current stock in the warehouse, etc.). So profile 1 can be built by anyone as a service profile and you can use it in your profile to enrich your own information. So you only give profile 1 an item number, for example, and get back the desired data, without having to know what happens in the background, such as database queries or accesses to an ERP system. You also do not have to worry about changes in how those other systems are accessed. Your profile 2 can stay the same and only profile 1 has to be maintained if necessary. So just the way you want it in a service-oriented architecture.

Example Profiles


Example 1

Example 2

Example 3

Example 4

Example 5