Table of contents

- General concept
- By navigation type
- By definition type
- Attributes allowed
- Examples

i | Text Block |

- This documentation is valid for:
- GeneXus 18 Help
- GeneXus 17 Help
- GeneXus 16 Help
- GeneXus 15 Help
- GeneXus X Evolution 3 Help
- GeneXus X Evolution 2 Help
- GeneXus X Evolution 1 Help
- GeneXus X Help

**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