# 1

# Actions

Actions are bits of SQL code which depends on variables and can be executed from the contextual menu of any data set presented in a grid.

For example if there is a table "products" which lists some kind of products and a table "comments" which lists all the comments left by users on a product (presumably the "comments" table will have a foreign key on the "products" table to reference it).

An action can be defined to show all the entries in the "comments" table provided the key is defining a product. Then anytime a product is listed in a result set, the contextual menu will allow the user to execute this action and thus display all the comments on the selected product. This situation is illustrated in the following figures.

The first step is to define an action, which is just a favorite in the query execution perspective which is defined as an action: bring up the properties for the favorite, and make sure the "Is action" toggle is checked:

# Action - define an action

Define the action to list the comments for a product, from the query execution perspective

# Action - display a list of products

In the query execution perspective, let's select all the products. Notice that there are here two defined actions: "Add comment on product" and "List comments for product"

Now let's pop up the contextual menu:

# Ação - menu de contexto

Exibe o menu de contexto e seleciona Executar ação Listar comentários para produto

After a confirmation of the parameters to execute the action, the result is there:

# Ação - executada

The action is now executed