Sometimes, we may want to assign a value to a variable or a variable property, within the definition of an object.
The object section where the assignment may be defined depends on the object (events in web panels, source in procedures, etc.)
The value type must match the variable or variable property type. Otherwise, the navigation report will display a warning message.
It is possible to assign a fixed value, a value that results from evaluating an expression or an inline formula, or a value stored in an attribute or variable.
&var | &var.property operator expression
&var | &var.property
Is the variable or variable property to be assigned.
One of the following assignment operators: = , +=, -=, *=, /=.
Assignable expressions are: Attributes, Variables, Constants, Functions, Arithmetic Expressions, Inline Formulas.
InvoiceId* (Autonumber property = Yes)
This example assigns, to a variable, the aggregate result of all invoice total amounts (this code may be included in a procedure source or web panel event) :
&InvoicesTotalAmount = Sum(InvoiceAmount)
This example assigns the true or false value to a variable, depending on whether a specific customer has invoices or not (this code may be included in a procedure source or web panel event, upon considering if the context of the web panel has base table or not) :
defined by InvoiceDate
Note: Instead of filtering by a fixed value of CustomerId, the object may receive a variable as a parameter (for example &CustomerId in the parm rule) and use it in the where clause.
Let's now suppose we have configured the Invoice transaction Bussines Component property = True, and the &Invoice variable type = Invoice.
The following code assigns a value to each &Invoice variable property. Following such assignments, it inserts the customer record:
&Invoice type = Invoice
Assignment Command for attributes