Wiki source code of Transformation - Grouping

Last modified by Danniar Firdausy on 2024/09/17 09:57

Show last authors
1 {{container}}
2 {{container layoutStyle="columns"}}
3 (((
4 In this microlearning, we will explore the grouping functionality, which allows you to organize data based on specific criteria, ensuring efficient and customized transformations. Before diving into the details of grouping functionality within eMagiz's transformation tooling, it's important to understand the basic concepts covered in the [[crash course>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course Platform.crashcourse-platform-create-transformation-xml-to-xml||target="blank"]].
5
6 Should you have any questions, please get in touch with academy@emagiz.com.
7
8 == 1. Prerequisites ==
9
10 * Basic knowledge of the eMagiz platform
11
12 == 2. Key concepts ==
13
14 This microlearning focuses on the grouping functionality that eMagiz offers as part of the transformation.
15
16 * With grouping we mean: The functionality that groups a list based on one or more specific criteria.
17
18 == 3. Transformation - Grouping ==
19
20 This provides several options for organizing a list of source entities into groups within the transformation tooling. The groups are created based on shared values of a grouping key or a pattern that specifies the start of a new group.
21
22 There are three options you have to group parts of your output:
23
24 * Group By
25 * Starting With
26 * Use Current Group
27
28 {{info}}Note that you can use this operation combined with a Filter operation to restrict the source elements you want to group.{{/info}}
29
30 To activate the grouping functionality, press the + icon in front of the list entity (in my case, "Design"). Here, you have the custom snippet, filter, and group option (from left to right)
31
32 [[image:Main.Images.Microlearning.WebHome@intermediate-create-your-transformations-grouping--operations-on-entity.png]]
33
34 Once you have selected the group option, a pop-up will appear containing three options. Each of these options is discussed below.
35
36 [[image:Main.Images.Microlearning.WebHome@intermediate-create-your-transformations-grouping--grouping-popup.png]]
37
38 === 3.1 Group By ===
39
40 If the option Group By is selected, the groups will be created based on the selected Key attribute. If your grouping-key is complex, select Custom Key and write a custom XPath expression. In the dropdown menu, you can choose all attributes belonging to the **input** list or the [Custom Key] option. Selecting the second option allows you to specify your own XPath to get the correct value on which to base your grouping logic.
41
42 [[image:Main.Images.Microlearning.WebHome@intermediate-create-your-transformations-grouping--grouping-popup-dropdown.png]]
43
44 === 3.2 Starting With ===
45
46 The option Starting with allows you to write an XPath expression specifying the start of a new group. Start with an expression, an attribute, or an entity from your source list. From that point, every item goes into the new group until another element matches the condition.
47
48 For example, if your source file contains HTML, where h1 describes the name of a book chapter and the following p elements, describe a chapter summary. You could use this operation to start a new group for each h1 found and add them to a chapter element. Example of the output of such an XML structure:
49
50 {{code type="xml"}}
51 <chapters>
52 <chapter>
53 <h1>Chapt1</h1>
54 <p>summary 1</p>
55 </chapter>
56 <chapter>
57 <h1>Chapt2</h1>
58 <p>summary 2</p>
59 </chapter>
60 </chapters>
61 {{/code}}
62
63 === 3.3 Current Group ===
64
65 When you want to create a group within a group, you should utilize this functionality to achieve this. This is only used in very complex cases and is quite difficult to use. So we strongly advise testing this scenario in particular very thoroughly.
66
67 {{info}}Note that when there is no current group, eMagiz will inform you about this to avoid that you break the transformation functionality within your flow.
68
69 [[image:Main.Images.Microlearning.WebHome@intermediate-create-your-transformations-grouping--current-group-without-a-parent-group.png]]
70 {{/info}}
71
72 If you already have a group to start with, you will see the following pop-up, which determines the logic of the current group.
73
74 [[image:Main.Images.Microlearning.WebHome@intermediate-create-your-transformations-grouping--current-group-with-a-parent-group.png]]
75
76 == 4. Key takeaways ==
77
78 eMagiz offers three distinct options for grouping data within transformations:
79
80 * Group By: Use this option to group data based on a specific key attribute or a custom XPath expression when more complex logic is required.
81 * Starting With: Ideal for creating new groups based on a starting condition, such as when a specific element or pattern in the data is detected.
82 * Use Current Group: This advanced option allows you to create subgroups within existing groups, suitable for complex transformations that involve nested data.
83
84 You can pair grouping with other transformation operations, like filtering, to fine-tune which elements are grouped, enhancing control and flexibility.
85
86 == 5. Suggested Additional Readings ==
87
88 If you are interested in this topic and want more information on it please read the help text provided by eMagiz and read the following links:
89
90 * [[Crash Courses (Menu)>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.WebHome||target="blank"]]
91 ** [[Crash Course Platform (Navigation)>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course Platform.WebHome||target="blank"]]
92 *** [[Transformation XML to XML (Explanation)>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course Platform.crashcourse-platform-create-transformation-xml-to-xml||target="blank"]]
93 *** [[Data type transformation (Explanation)>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course Platform.crashcourse-platform-create-data-type-transformations||target="blank"]]
94 *** [[XPath Basic (Explanation)>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course Platform.crashcourse-platform-create-transformation-xpath-basic||target="blank"]]
95 * [[Intermediate (Menu)>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.WebHome||target="blank"]]
96 ** [[Create your transformations (Navigation)>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.Create your transformations.WebHome||target="blank"]]
97 *** [[Default eMagiz XSLT Functions (Explanation)>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.Create your transformations.intermediate-create-your-transformations-emagiz-xslt-functions||target="blank"]]
98 * [[Transformation Grouping (Search Results)>>url:https://docs.emagiz.com/bin/view/Main/Search?sort=score&sortOrder=desc&highlight=true&facet=true&r=1&f_space_facet=0%2FMain.&l_space_facet=10&f_type=DOCUMENT&f_locale=en&f_locale=&f_locale=en&text=%22transformation+-+grouping%22||target="blank"]]
99
100 )))
101 ((({{toc/}}))){{/container}}
102 {{/container}}