Example 4 steps
-
Create collector loops.
To collect the input data, we need two nested loops, one for the repetitive element Employee and one for the repetitive element Time
The loops are controlled by these elements. Insert one Collector function into each loop.
-
Collect data.
-
Drag and drop the input elements FirstName, LastName, and EmployeeNumber to the first Collector function.
-
Because we modify the date, create a UVJ function.
Insert a UVJ function into the inner loop before the second Collector function.
Drag and drop the input element Date to the Java function and create an output parameter oDate.
-
Create a logic in the UVJ function to remove time, so that the input date and time
2013-06-17T16:43:23
is converted to20130617
. Use the EDIFACT format"102"
, that is the format CCYYMMDD. This format is equal toD8
for ANSI X12.For example, use this Java code:
oDate = new DateTimeConverter().setXMLDateTime(iDate).getEDIDateTime("102");
-
Create a new input parameter Date in the second Collector function.
Drag and drop the Java function’s output parameter oDate to the Collector function’s input parameter Date.
Drag and drop the input elements Project and Hours to the second Collector function.
-
-
Create restructure loops.
This step is the same as step 1 in Example 2. Create the three nested restructure loops after the collector loops.
-
Select data.
Instead of using the input document’s elements, we use the Collector functions’ output parameters.
-
Drag and drop these parameters:
-
Date from the second Collector function to the first Restructure function
-
FirstName from the first Collector function to the second Restructure function, and so on
-
-
Because we are restructuring the data, you do not need to match the loop levels for the Collector functions and the Restructure functions. Additionally, you have already created the collector loops for this purpose, so you do not need to select input loop levels for the Restructure functions as you do in Example 2.
-
Drag and drop from the Restructure functions’ output parameters to the elements and attribute in the output document.
-
-
Sort and group the data.
This step is the same as step 4 in Example 2. This example only differs on how you define which data to use. Sorting and grouping are done exactly in the same way as in Example 2.