Wiki source code of Transformation - Grouping

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

Hide last authors
eMagiz 21.1 1 {{container}}
2 {{container layoutStyle="columns"}}
3 (((
Danniar Firdausy 40.14 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"]].
eMagiz 1.1 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
Erik Bakker 34.1 14 This microlearning focuses on the grouping functionality that eMagiz offers as part of the transformation.
eMagiz 1.1 15
Danniar Firdausy 40.12 16 * With grouping we mean: The functionality that groups a list based on one or more specific criteria.
eMagiz 1.1 17
Erik Bakker 34.1 18 == 3. Transformation - Grouping ==
eMagiz 1.1 19
Erik Bakker 40.1 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.
Erik Bakker 34.1 21
22 There are three options you have to group parts of your output:
Danniar Firdausy 40.3 23
Erik Bakker 34.1 24 * Group By
25 * Starting With
26 * Use Current Group
27
Erik Bakker 40.1 28 {{info}}Note that you can use this operation combined with a Filter operation to restrict the source elements you want to group.{{/info}}
Erik Bakker 34.1 29
Erik Bakker 40.1 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)
Erik Bakker 34.1 31
32 [[image:Main.Images.Microlearning.WebHome@intermediate-create-your-transformations-grouping--operations-on-entity.png]]
33
Erik Bakker 40.1 34 Once you have selected the group option, a pop-up will appear containing three options. Each of these options is discussed below.
Erik Bakker 34.1 35
36 [[image:Main.Images.Microlearning.WebHome@intermediate-create-your-transformations-grouping--grouping-popup.png]]
37
38 === 3.1 Group By ===
39
Erik Bakker 40.1 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.
Erik Bakker 34.1 41
42 [[image:Main.Images.Microlearning.WebHome@intermediate-create-your-transformations-grouping--grouping-popup-dropdown.png]]
43
44 === 3.2 Starting With ===
45
Erik Bakker 40.1 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.
Erik Bakker 34.1 47
Erik Bakker 40.1 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:
Erik Bakker 36.1 49
Erik Bakker 35.1 50 {{code type="xml"}}
Erik Bakker 34.1 51 <chapters>
52 <chapter>
Erik Bakker 37.1 53 <h1>Chapt1</h1>
54 <p>summary 1</p>
Erik Bakker 34.1 55 </chapter>
56 <chapter>
Erik Bakker 37.1 57 <h1>Chapt2</h1>
58 <p>summary 2</p>
Erik Bakker 34.1 59 </chapter>
60 </chapters>
Erik Bakker 35.1 61 {{/code}}
Erik Bakker 34.1 62
Erik Bakker 38.1 63 === 3.3 Current Group ===
64
Erik Bakker 40.1 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.
Erik Bakker 39.1 66
Erik Bakker 40.1 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.
Erik Bakker 38.1 68
Erik Bakker 40.1 69 [[image:Main.Images.Microlearning.WebHome@intermediate-create-your-transformations-grouping--current-group-without-a-parent-group.png]]
Erik Bakker 38.1 70 {{/info}}
Erik Bakker 39.1 71
Erik Bakker 40.1 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.
eMagiz 1.1 73
Erik Bakker 40.1 74 [[image:Main.Images.Microlearning.WebHome@intermediate-create-your-transformations-grouping--current-group-with-a-parent-group.png]]
eMagiz 1.1 75
Eva Torken 32.1 76 == 4. Key takeaways ==
eMagiz 1.1 77
Danniar Firdausy 40.15 78 eMagiz offers three distinct options for grouping data within transformations:
Danniar Firdausy 40.4 79
Danniar Firdausy 40.15 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
Eva Torken 32.1 86 == 5. Suggested Additional Readings ==
eMagiz 1.1 87
Danniar Firdausy 40.2 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"]]
Danniar Firdausy 40.9 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"]]
Danniar Firdausy 40.7 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"]]
Danniar Firdausy 40.5 99
Eva Torken 32.1 100 )))
eMagiz 21.1 101 ((({{toc/}}))){{/container}}
102 {{/container}}