Official Content

The Data Provider Group statement Unique Clause is optional, and allows you to determine which attributes should not have duplicated values in the output.

It is the equivalent of Unique clause in For Each command. Thus, for further examples see there. 

Below are some examples where this clause could be used to solve the proposed problem. 

Example 1

Get the sales by date. The output will be a collection SDT, SalesByDay, where each item, named Day, is a simple SDT with two elements: Day and Total. 

SalesByDay from Invoice Unique InvoiceDate
{
   Day 
   {
      Day = InvoiceDate
      Total = sum(InvoiceTotal)
   }
}

Remember in Data providers repetitive groups loaded from database, it is exactly the same to declare the group base transaction, order, where, etc. at the outer group name (the collection one) or at the inner group name (the item itself). That is:

SalesByDay 
{
   Day from Invoice Unique InvoiceDate
   {
      Day = InvoiceDate
      Total = sum(InvoiceTotal)
   }
}

Example 2

Another example, adding order clause and using clause. 

SalesByDay
{
   Day FROM invoice
   order InvoiceDescription
   USING dataSelector1(InvoiceDate)
   Unique InvoiceDate
   {
      Day4 = InvoiceDate
      Total4 = sum(InvoiceTotal)
   }
}

See Also

 

 






Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant