Updates the database by assigning a value that results from evaluating an expression, a fixed value or a value stored in an attribute/variable to an attribute or variable.
att | &var = expression [ If condition ] [ on triggering event];
att | &var
Is the attribute or variable to be assigned. In the case of being an attribute, it cannot be a formula.
expression
Is any valid expression that can involve constants, functions, procedures, variables, or other attributes (the result must match the attribute or variable type definition).
condition
Is any valid logic condition (that can contain the "and", "or", and "not" logical operators).
triggering event
Is one of the predefined events available in GeneXus for transaction rules, which allows you to define the precise time for executing a rule.
Objects: Transaction
Generators:.NET,
.NET Framework,
Java, RPG, Cobol, Visual FoxPro (up to GeneXus X Evolution 3), Ruby (up to GeneXus X Evolution 3).
Consider the following Transaction object:
Customer
{
CustomerId*
CustomerName
CustomerAddress
CustomerPhone
CustomerAddedDate
CustomerLastUpdateDate
}
Now observe the following rules defined in that Transaction to assign values to certain attributes and variables:
CustomerAddedDate = today() if insert;
CustomerLastUpdateDate = today();
&DiscountPercentage=10 if CustomerAddedDate.year() < 2011;
Assignment command for variables
Assignment command for attributes