Compound Formulas

A Compound Formula is an expression whose definition includes several Horizontal and/or Aggregate formulas.

Look at the following example. Given these transactions:

Flight Transaction 

       FlightId*

       FlightDescription

       FlightPrice

       FlightInstanceAveragePrice = Sum(FlightInstancePrice) / Count(FlightInstanceDate)


FlightInstance Transaction

       FlightInstanceNumber*

       FlightId

       FlightDescription

       FlightPrice

       FlightInstanceDate

       FlightInstanceNumberOfPassengers

       FlightInstancePrice = FlightPrice if FlightInstanceNumberOfPassengers <= 100;

                             FlightPrice * 0.9 if FlightInstanceNumberOfPassengers > 100 and FlightInstanceNumberOfPassengers < 200;

                             FlightPrice * 0.8 otherwise;

FlightInstanceAveragePrice is a Compound Formula (defined in a global way).

The following image shows the "Flight" transaction being edited with the GeneXus transaction editor, and the FlightInstanceAveragePrice compound formula attribute being edited with the GeneXus formula editor: 

Compound

Note that FlightInstancePrice is an horizontal formula.