Official Content

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:

GlobalFormulaExample

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:

Data Selector Flight1

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 FormulasRedundant Formulas, Generating SQL statements










Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant