Data provider Element statement

Official Content

Data provider Element 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 which may also be of a SDT data type. 

Each Element must be assigned inside a Data provider Group statement, and the syntax used is that of Inline Formulas

Syntax

<elementName> [ = <formula> ] [<elementProperties>]

where:

<elementName>:

is the name of the element in the output SDT or BC. If it matches the attribute name that is assigned to the right  (e.g. "CustomerName = CustomerName"), the assignment could be omitted, making it more compact. But beware: the elements on the left are not attributes (but "elements"), unlike those on the right. The datatype of <elementName> must match with <formula> resulting datatype. It can be an SDT as well.

<formula>:

is a conditional formula (horizontal as well as aggregate or compound). That is, it could be several conditional expressions. This includes either an isolate attribute, or an invocation to a procedure with output or a data provider, a constant, as well as the typical formulas. 

<elementProperties>::= '['<Default>']' '['<XmlInfo>']'

<XmlInfo>::= '[' XmlType = { attribute | cdata | element | value } ']'

Example

Customers
{
    Customer
    {
         Code = CustomerId
         CustomerName
         Address = GetAddress( CustomerAddress, CityName )
         Age = &Today.Year() - CustomerBirthDate.Year()
         Discount = 100 if CustomerStatus = Status.Gold; 0 otherwise;
         Amount = Sum( InvoiceTotal )
    }
}

Here we have four element assignments inside the Customer group. 

  1. The element Code is assign with the value of CustomerId attribute.
  2. The element CustomerName is assign with the value of the attribute with the same name.
  3. Address, an element of a SDT datatype is assign with the result of executing the GetAddress Data Provider (that returns such a SDT loaded)
  4. The element Age is assign with the result of evaluating the horizontal formula
  5. The element Discount is assign with the result of evaluating the conditional horizontal formula
  6. The element Amount is assign with the result of calculating the aggregate formula

 





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