Table of contents

Official Content

Formulas are expressions that, once evaluated, return a certain value.

When an attribute or variable value can be calculated from other attributes, variables, constants, methods, arithmetic operations, etc., it can be defined as a Formula. In addition, when this assignment is done associated with an attribute definition (that is, for the attribute, inside the Transaction Structure where it is specified), the attribute itself is known as a Global Formula

There are two ways to define formulas:

  1. Global Formulas (Global definition, at the Knowledge Base level)
  2. Local / Inline Formulas (Local definition, within objects' code) 

Classification of Formulas by navigation type

Formulas can be classified into three groups, depending on the type of calculation needed. This classification is valid either for global or local formulas. 

All these kinds of formulas may have trigger conditions.

Note: When defining a formula, you don't need to indicate if it belongs to one classification or another. This is only an external classification.

Base table of a Formula

The table that is navigated in order to evaluate the formula is known as its base table. Depending on the kind of formula, the evaluation will consider only one record (horizontal formula) or many (aggregate formula). 

Optimized generated code

Defining formulas is even better than writing Procedure objects and invoking them.

When you define a formula, GeneXus has the knowledge of its definition and is able to generate optimized sentences by combining the formula query with the query in which the formula is present.

On the other hand, if you define a Procedure and invoke it, the Procedure code is not "visible" from the invoker, and GeneXus can't combine the knowledge and generate the most optimized code.

See Also

Formulas/Generating SQL
Changes in Formulas terminology

Subcribe to this category's changes
Sub CategoriesAdd a new subcategory in this category
PagesAdd a new page in this category
Last update: November 2023 | © GeneXus. All rights reserved. GeneXus Powered by Globant