# 1

# 操作

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:

# Action - contextual menu

Pop up the contextual menu and select Execute action List comments for product

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

# Action - executed

The action is now executed