Data provider Element

Official Content

It is one of the three main components of the Data Provider output-based declarative language.

An Element is an atomic value in the Output. 'Code' and 'Name' are Elements in the following example:

Customers    // this is a Group
{
   Customer  // this is a Group
   {
      Code = CustomerId    // this is an Element assignment
      Name = CustomerName  // this is an Element assignment
   }
}

Each Element must be assigned by means of a Data provider Element statement. Its syntax is that of Inline Formulas

Example

SampleOfElements
{ 
   Constant = 'ABC' 
   Complex = 1 if CustomerBalance > 1000; 0 otherwise; 
}

Note: IIf clause can be used too, as well as aggregation formulas.

If an Element is assigned with some attributes, GeneXus will infer how to obtain them from the database in the same way it does in the For Each command.

Elements and Attributes usually have the same name, as follows:

Customers 
{
   Customer 
   {
      CustomerId = CustomerId
      CustomerName = CustomerName
   }
}

But beware: the elements on the left are not attributes (but "elements"), unlike those on the right. In order to allow a more compact writing, this code is the same as the following:

Customers    
{
   Customer
   {
      CustomerId
      CustomerName
   }
}

And we can still make it more compact. We can omit the Item name and GeneXus will infer it.

DPLanguejeOmitItem

The Item name is necessary if any element of the collection will have different inputs.

Samples
{
   //Fixed Data
   SampleItem
   {
      SampleId = 0
      SampleDsc = 'Fix sample'
   }
   // Data retrieved from the data base 
   SampleItem 
   { 
      SampleId = SampleIdInTable 
      SampleDsc = SampleIdInTable
   }
}





Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.