Adding a Restructure function in a Mapping
A Restructure function behaves as a UBJ function.
Consider these function behaviors:
-
This function controls the loop iterations.
-
You can only create this function in a loop.
-
There can only be one Restructure function within a loop and it must be the first in the loop's sequence.
Use this procedure to add a Restructure function in a mapping. Repeat this procedure for nested restructure loops, if necessary.
- Double-click a mapping to open it in the Mapper Editor.
-
In the Core Functions pane, select Restructure.
Drag and drop it in the space inside a loop where the Restructure function must be added.
A control link from the Restructure function to the loop is automatically created.
Note: When connecting input elements, you can drop elements only where it is acceptable. -
Add input parameters to receive input data.
You can use data directly from the input document or from Collector functions.
To create an input parameter, follow these instructions:
-
To use data directly from the input document, click and drag a data element or an attribute from the input document to the parameter area.
-
To use data from a Collector function, click and drag an output parameter for a Collector function to the parameter area.
A corresponding output parameter is automatically created.
The input links to Restructure functions are dashed to indicate that data is not read when executing the restructure function. Instead the data has already been read.
-
-
Add input control links to the function header.
This is only valid when you are using data directly from the input document. Control links to function headers when using data from collector functions, are not allowed.
Add this to indicate repeating elements in the input document that must control loops when reading the data. The icon for Restructure input parameters, similar with Collector output parameters, is dashed to indicate reference parameters.
Click and drag a repeating element from the input document to the function header. A bold dotted input link is created.
You can create several control links to the Restructure function, if needed.
-
Link the output parameters that contain the restructured data.
Click and drag an output parameter to a data element or an attribute in the output document or vice versa.
You can also assign an output parameter to a global variable or click and drag the output parameter to an input parameter for succeeding function.
-
Define the restructure processing.
Use these property settings for the input parameters:
Property Details Sorting Sequence Settings for the sorting sequence:
-
0
for no sorting -
A positive integer to sort the data
A given sorting sequence
>0
must be unique within the function.
The default value for this property is
0
.Sort Order If sorting sequence is
>0
, then set the sort order:-
Ascending
-
Descending
The default value for this property is Ascending.
Is Grouped If sorting sequence
>0
, then use these grouping settings:-
false no grouping
-
true grouping of the data
The default value for this property is false.
You can only set this property to true for the input parameter with the highest sorting sequence.
If a sorting sequence is set for two or more input parameters, data is grouped on the unique combination of these parameter values.
Is Summable -
If another input parameter is grouped and the data for the current input parameter is numerical, you can set this property to true to automatically sum the data.
-
If another input parameter is grouped and this property is set to the default false, data is used from the first record in the current group according to the total sorting.
-
If no input parameter is grouped, this property has no effect.
Note: If you set an invalid value for a property, then the value is automatically reverted to its previous value. If you click Tab after setting an invalid property value, then an error message is displayed in the status bar. -
-
Save the function in the Mapping Editor.
For a nested Restructure loop structure for all Restructure functions within the Restructure loop structure, you must directly use data from the input document or from Collector functions. You cannot, for example, use data from the input document in the outer Restructure loop and use data from Collector functions in the inner Restructure loop. Because data would then come from different contexts, there is no structural relationship between the input document and the Collector functions. To restructure the data, ensure that all input data belongs to the same structure.