A 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.
<elementName>[=<formula>]'['<elementProperties>']'
View Syntax conventions
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 data type of <elementName> must match with <formula> resulting data type. 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
It can take one of the following values: Default, XmlInfo.
XmlInfo is defined as follows: '[' XmlType = attribute | cdata | element | value ']'
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 you have four element assignments inside the Customer group.
- The element Code is assign with the value of CustomerId attribute.
- The element CustomerName is assign with the value of the attribute with the same name.
- Address, an element of a SDT data type is assign with the result of executing the GetAddress Data Provider (that returns such a SDT loaded)
- The element Age is assign with the result of evaluating the horizontal formula
- The element Discount is assign with the result of evaluating the conditional horizontal formula
- The element Amount is assign with the result of calculating the aggregate formula