1) The following image shows the "FlightInstance" transaction being edited with the GeneXus transaction editor, and the PassengerAge attribute being defined as a global formula using the GeneXus formula editor:
As you can see, in this defined formula a function was used to obtain the desired calculation.
2) Given the following transactions:
Flight Transaction
FlightId*
FlightDescription
FlightInstance Transaction
FlightInstanceId*
FlightId
FlightDescription
FlightInstanceDate
FlightInstancePrice
Suppose that you have defined a Data Selector as follows:
The following code shows an inline formula defined outside a For Each command that references the above Data Selector with the USING clause:
&FlightPriceTotal = Sum(FlightInstancePrice, using OneFlight(), 0)
The table navigated by this inline formula is: FLIGHTINSTANCE in order to summarize all the FlightInstancePrices that belong to the FlightId=1.
3) Taking into account the FlightInstance transaction proposed in the above examples, we will show two For Each commands in which inline formulas are defined in their where clause:
for each
where Average(FlightInstancePrice) > 450

endfor
for each
where Sum(FlightInstancePrice) / Count(FlightInstanceDate) > 100

endfor
See also: Horizontal Formulas, Aggregate Formulas, Compound Formulas, Redundant Formulas, Generating SQL statements
