eBiss 3

Hilfe & Dokumentation

User Tools

Site Tools


en:transformation:mappings:funktionen:gruppierung:groupbyexsorted

GroupByExSorted

The mapping function GroupByExSorted() sorts the grouped result by (Key's). There are up to 6 key fields possible.

Syntax:

GroupByExSorted('Node', 'Key1', 'Key2', 'Key3', ..., 'Key6')
GroupByExSorted('Node', 'Attribut1', 'Attribut2', 'Attribut3')

Notes

  • The 'Key' values are treated internally as character strings. What is relevant when sorting by numeric or date values and a explicit formatting as a character string makes sense, e.g.:
     GroupByExSorted('//IndustryItems', 'FormatNumber(@PosNumber, "0000000")'). 
  • It is possible to group attributes that are located in different depths of the node levels. To do this, however, the node must point to the lowest level. The hierarchically higher-ordered attributes must then be added by a “… /” reference.
  • If XPATH filters are required, make sure to use double and single quotation marks correctly.(See examples)

Samples

  1. Grouped and sorted under /InventoryReport/Items by @Ean
    GroupByExSorted(/InventoryReport/Items, "@Ean")
  2. Returns a list of all LIN nodes, grouped by the DE_7140 attributes whose DE_7143 attribute contains the value' GU'.
    GroupByExSorted(//LIN, "../PIA/*[@DE_7143='GU']/@DE_7140")
  3. Returns a list of all SG_33 nodes, grouped by the DE_7140 attributes whose DE_7143 attribute contains the value' GU'.
    GroupByExSorted(//SG_33, "PIA/*[@DE_7143='GU']/@DE_7140")
  4. Returns a list of all LIN nodes, grouped by the article details color attributes whose EAN is equal to the value in the DE_7140 attribute.Returns a list of all LIN nodes, grouped by the article details color attributes whose EAN is equal to the value in the DE_7140 attribute.
    GroupByExSorted(//LIN, "GetArticleDetailsByEAN(DG_212/@DE_7140)/Detail/@Color")
  5. Group SLSRPT groups whose CustomItem key is =' EK_Department':
    GroupByExSorted(//Groups,"CustomItem[@Key='EK_Department']/@Value")
  6. Groups the sales report according to the ID specified under PIA[@DE_4347=' 1']/DG_C212[@DE_7143=' LN']/@DE_7140 1).
    GroupByExSorted(//SG_7,"PIA[@DE_4347='1']/DG_C212[@DE_7143='LN']/@DE_7140")
  7. Groups the sales report by location, SalesDate, and then by PIA[@DE_4347=' 1']/DG_C212[@DE_7143=' LN']/@DE_7140, in which case it is noteworthy that the group keys are located in different segments. This means that the grouping must be routed to the lowest node 2).
    GroupByExSorted(//SG_5/SG_7,"../LOC/DG_C517/@DE_3225","../DTM/DG_C507[@DE_2005='356' and @DE_2379='102']/@DE_2380","PIA[@DE_4347='1']/DG_C212[@DE_7143='LN']/@DE_7140")

    The keys therefore contain:

    1. @Key1 = Location
    2. @Key2 = SalesDate
    3. @Key3 = e. g. ID of a purchasing department (e. g. at Breuninger)

  8. Groups the sales report by location, SalesDate and then by RFF/DG_C506[@DE_1153 =' SB']/@DE_1154. It should also be noted here that the group keys are located in different segments. This means that the grouping must be routed to the lowest node 3)(analogue to the previous example) and switched up for the higher-level segments with “… /”.4).
    GroupByExSorted(//SG_5/SG_7,"../LOC/DG_C517/@DE_3225","../DTM/DG_C507[@DE_2005='356' and @DE_2379='102']/@DE_2380","RFF/DG_C506[@DE_1153 = 'SB']/@DE_1154")

    The keys therefore contain:

    1. @Key1 = Location
    2. @Key2 = SalesDate
    3. @Key3 = e. g. an original location (e. g. near DeBijenkorf)

Nesting

In special cases it may be necessary to sort 5) before the actual grouping. This can be done by nesting the function. Note that the path /Items is appended to the nested grouping function 6).

Nesting sample

GroupByExSorted(GroupByExSorted(/TradeItemDocument/TradeItems,' @ArticleNo',' @Color',' @Size')/Items,' @ArticleNo',' @Color')

In this example, the incoming items are sorted and grouped according to article number, color and size, and then only sorted and grouped according to article number and color, so that the sizes within a target record can be iterated in ascending order.

unsorted result:

 <TradeItems OfferNo="0" SupArtNo="1-1-25316-21" SupColNo="001" ArtDesc="Woms Boots" ColDesc="BLACK" SupplierPhotoName="0012531621001.JPG "SupplierModel=" Lycoris "SupplierGender=" Women "SupplierBrand=" TAMARIS "SupplierCollCode=" W "SupplierCollYear=" 18 "IntrasNo=" 2 "SupplierCOO=" CN "SupplierUppMat=" IMI SUEDE "SupplierSolMat=" synthetic "SupplierLinMat=" Lining=Polyester 
  SizeDesc1="36" Barcode1="4059252686483" RetailPrice1="59.95" 
  SizeDesc2="37" Barcode2="4059252686490" RetailPrice2="59.95" 
  SizeDesc3="38" Barcode3="4059252686506" RetailPrice3="59.95" 
  SizeDesc4="39" Barcode4="4059252686513" RetailPrice4="59.95" 
  SizeDesc5="40" Barcode5="4059252686520" RetailPrice5="59.95" 
  SizeDesc6="41" Barcode6="4059252686544" RetailPrice6="59.95" 
  SizeDesc7="35" Barcode7="4059252766758" RetailPrice7="59.95" 
  SizeDesc8="42" Barcode8="4059252686575" RetailPrice8="59.95" />

sorted result:

 <TradeItems OfferNo="0" SupArtNo="1-1-25316-21" SupColNo="001" ArtDesc="Woms Boots" ColDesc="BLACK" SupplierPhotoName="0012531621001.JPG "SupplierModel=" Lycoris "SupplierGender=" Women "SupplierBrand=" TAMARIS "SupplierCollCode=" W "SupplierCollYear=" 18 "IntrasNo=" 2 "SupplierCOO=" CN "SupplierUppMat=" IMI SUEDE "SupplierSolMat=" synthetic "SupplierLinMat=" Lining=Polyester 
  SizeDesc1="35" Barcode7="4059252766758" RetailPrice7="59.95" 
  SizeDesc2="36" Barcode1="4059252686483" RetailPrice1="59.95" 
  SizeDesc3="37" Barcode2="4059252686490" RetailPrice2="59.95" 
  SizeDesc4="38" Barcode3="4059252686506" RetailPrice3="59.95" 
  SizeDesc5="39" Barcode4="4059252686513" RetailPrice4="59.95" 
  SizeDesc6="40" Barcode5="4059252686520" RetailPrice5="59.95" 
  SizeDesc7="41" Barcode6="4059252686544" RetailPrice6="59.95" 
  SizeDesc8="42" Barcode8="4059252686575" RetailPrice8="59.95" />
1)
This is, for example, the purchasing department
2)
PIA is here under “SG_5/SG_7”) and switched up for the higher-level segments with “… /” accordingly ((As specified:“… /LOC/DG_C517/@DE_3225” and “… /DTM/DG_C507[@DE_2005=' 356' and @DE_2379='102']/@DE_2380”,
3)
RFF is here under “SG_5/SG_7”
4)
As specified:“… /LOC/DG_C517/@DE_3225” and “… /DTM/DG_C507[@DE_2005=' 356' and @DE_2379=' 102']/@DE_2380”,
5)
on a data element within the desired grouping
6)
which is used for pre-sorting at a lower level
en/transformation/mappings/funktionen/gruppierung/groupbyexsorted.txt · Last modified: 2024/02/20 08:15 by 127.0.0.1