Graphical query tool
The graphical query tool includes a feature used to create inquiry screens that display the results of database queries. It works by temporarily extracting data into a table, then running a query on that table. The inquiry can be made at multiple levels of detail, defined by successive page breaks.
You can retain the results of your most recent query in this temporary table (unless the query is shared). Using this functionality involves 3 distinct phases:
-
Define the query using this Graphical query tool function (GESALT)
-
Run the query by clicking the Run button.
-
Consult the results if the query has already been executed.
You can build queries using table fields or expressions. Table joins are automatically determined based on the data dictionary, but you can also define joins manually by dragging a field from one table to another. To do so, the destination field must be part of a key.
Additionally, 2 complementary tools are available:
-
The Query tool function (GESALH), offering similar functionality in a tabular interface.
-
The SQL query tool function (GESALQ), which uses the same inquiry screens but allows you to design queries directly in SQL.
Prerequisites
Refer to the implementation documentation.
Screen management
The screen is defined in 5 tabs:
You can edit your query across multiple tabs, but only the first one is mandatory.
Header
The header provides information to identify the query, along with general configuration settings.
General information
| Code (COD) |
|
This code is used to identify a request. |
| Description (INTIT) |
|
Use this field to assign a description to each record. |
| Short description (INTITSHO) |
|
This title, which describes the record, is used in some screens or records when there is not enough space to display the long title. |
| Factory owner (AFACTORYOWN) |
| Indicates if the query is delivered by Sage. You cannot modify factory queries. |
Characteristics
| Activity code (CODACT) |
|
An activity code is used to:
|
| Module (MODULE) |
| Select the module to which your query belongs. |
Fields tab
Use this tab to define and organize the information to be edited using a visual editor.
Based on the elements configured in this editor, the query designer automatically generates a query on tables linked by join conditions.
In simple cases, the settings in this tab are sufficient, and it is not necessary to complete the next tabs.
| Active (ENAFLG) |
|
Select this checkbox to activate the current record. Inactive records keep their content and configuration but cannot be used by recalling their code:
Authorizations for a given function can restrict the creation of an active record. In this case, the checkbox is disabled by default. It can only be modified by an authorized user or through a signature workflow. |
| (CLBFL) |
|
The query creation field is comprised of a floating pallet, a design area for the template and another area to place the selected fields. Floating palletIt contains the following buttons:
Design area for the templateThe tablesThe added tables are represented with their joins in this design area. To add a table, click on the "Table" button of the floating pallet. The possible actions on a table are:
JoinsThe joins that have not been created automatically can be created by drag-and-drop from the source table field to the target table field. A left outer join is then created. Clicking on a join displays a menu used to change the join type (left outer or inner join) or delete it. BackgroundA drag-and-drop action to a free space in the design area makes it possible to reposition this space. Double-clicking is used to reposition the design area with respect to its origin.
Selected field location areaThe area where the selected fields are located is used to:
Add a fieldTo add a table field, it is necessary to double-click on it or to perform a drag-and-drop action to the selected field location area. Add an expressionTo add an expression, it is necessary to click on the "Expression" button of the floating pallet. Edit an expressionClick on the description of the expression to display the window of its properties. Modify the properties of a thumbnailClick on the icons to modify the values of the properties. A faded display specifies a negative value (for instance: not sorted). Delete a thumbnailClick on the cross in the upper right hand corner of the thumbnail. Move a thumbnailClick on the grip in the upper part of the thumbnail and move it without releasing pressure on the mouse button, then release on required position. Thumbnails can only be moved on a similar level. Create a break level (group)Click on the thumbnail grip, a menu appears with different descriptions. Select "Create a group" to put the thumbnail at the top of a new group. Move a thumbnail to an existing break levelClick on the thumbnail grip, a menu appears with different descriptions. Select "Group N" where N represents the group level, to move the thumbnail to the bottom of the selected level. |
Advanced tab
This tab is optional. It allows you to define:
-
Presentation criteria (such as page numbering and report layout)
-
Additional selection criteria
-
Specific join conditions
Join conditions are useful in two cases:
-
When the automatic join algorithm fails.
-
This is easy to identify because an error message displays when validating the query.
-
Often, adding a link to one of the tables not described in the dictionary resolves the issue. Other links remain automatic.
-
-
When the automatic join does not match the expected logic.
-
In complex cases, multiple links can exist between tables, but the algorithm stops at the first one it finds.
-
To verify the join, use the Info > Links action button, which displays the details of the detected links.
-
First block
| Number of lines (NBRLIG) |
|
Define the number of logical lines displayed per page in the inquiry screen generated by the query designer. If the specified number exceeds the available physical display space, a vertical scroll bar appears on the right side of the grid. Navigation buttons at the top of the screen allow you to move between logical pages (First, Previous, Next, Last). |
| Maximum lines (MAXLIG) |
|
Specify the maximum number of lines to return. This corresponds to the query parameter maxrows, which stops the search once the specified number of rows meeting the conditions is found in the database. These rows are then sorted, but the database does not guarantee that the retrieved rows are the first N in the final sort order. This parameter is an optimization to reduce database load. |
| No. of fixed columns (NBRCOL) |
|
Use this field to fix the first X columns of a grid when horizontal paging is enabled. |
| Maximum times (MAXTIM) |
|
Specify the maximum execution time for the search in seconds. If this time limit is reached, the search stops automatically. This helps avoid long wait times, especially when setting up a new query. Unlike the maximum number of lines, this setting is not sent to the database. The maximum time limit can still be exceeded if the inquiry takes too long to process.
|
| Report (RPT) |
|
Define the report code associated with the File / List function from the query inquiry. If no report code is specified, the ALISTE report is used, which applies a standard page format. You can duplicate this generic report and adjust the page format to create a custom report tailored to the inquiry. The report code entered here can also be linked to a set of print codes using the dedicated function. |
Selections grid
| Selection criteria (SEL) |
|
You can enter selection criteria, which are logical expressions applied to table fields. These expressions can include constants, functions, and operators. Only the rows that satisfy these conditions will be extracted from the table. To assist in writing these expressions, a formula editor is provided, making it easier to construct and validate complex criteria. |
Links grid
| Link expression (LNK) |
|
Use this field to define links that are not specified in the dictionary or that should take priority. The link structure must match the key of the target table and include as many fields (separated by semicolons) as there are key parts. Syntax: [F:ABV1]CLE=expression1 ; expression2..., where:
From the database perspective, this syntax defines left outer joins. To create a strict join (which can improve performance), add a tilde (~) before the key: [F:ABV1]CLE=expression1 ; expression2... |
Access tab
Use this tab to define the access conditions to the query and the extracted data.
| Query type (ALLUSR) |
|
This field controls how the query behaves in inquiry mode. There are three possible modes:
|
| Group (GRP) |
|
Makes a classification criterion available for requests. |
| Access code (ACS) |
|
Defines access control for the current record and query execution.
|
| Object (OBJLNK) |
|
This field determines the authorization filters applied when building the query. These filters are by site, by role, and by access code. Filtering principles:
The table on which the filters are applied must be included in the generated query. This refers to the table containing:
This table is not necessarily the main table in the query. Example: A query on document lines can still be filtered based on authorizations defined in the document header table. These filters are applied only when the query is executed, not when it is later viewed. This distinction matters if the query is shared or if a user’s site-specific filters have changed between the time the query was run and the time it is accessed.
|
| Function (FCTLNK) |
|
This field links query access authorizations to the permissions granted for the associated function. When a user opens a query, the system checks whether they are authorized to use the linked function. This is done for at least one site, if the function’s authorization is site-based. This check is performed only when the query is not shared. If the query is shared, the permissions of the person who executed the query apply and are inherited by all users who have viewing rights. Therefore, extra caution is required when defining authorizations for shared queries, especially when they involve sensitive data. These permissions are managed using the access code available in this tab. |
Graph tab
You can edit this tab only if a graphical representation is available for the query. It allows you to define how the data displays in the chart.
First block
| Representation (REPGRA) |
|
This indicator defines how data will be displayed on the screen. The available display modes are as follows:
|
| Default display or graphical position (OPTGRA) |
|
This setting defines how the graphical representation is positioned relative to the grid when the data display mode allows both formats.
|
Graph
| Type (TYPGRA) |
|
You can use this fieldwhen the grid contains multiple numeric values that can be displayed graphically. It supports two options:
|
| Representation (FSHGRA) |
|
When multiple series are displayed in a graph, provided they share the same presentation style and are not of the sector type, you can define how their values are combined by selecting one of the following options
|
| Default graph (DEFGRA) |
|
This field defines the type of graphical representation used to display the data. Options include Bars, Lines, Area, or Sectors. An image displays based on the selected option. If only one data series is available, the default representation is determined by this parameter. If multiple series are present, you can mix presentation modes (for example, one series as bars, another as lines). In this case, each series uses the value specified in the Representation field in the grid:
When only one series is displayed, a graph type selector is available, allowing the user to choose a different presentation mode. |
| (IMAG) |
|
Visual representation of the previously entered information. |
Specific buttons
-
Validate
This button generates a processing associated with the request as well as the dedicated inquiry screen. This validation is linked to the saving of a record, but it is possible to independently launch it if for example a request has been transferred by copy.
-
Copy
This button is used to copy the record definition from or to another folder.
The following fields are included on the window opened through this button:
Block 1
(OBJET)
(CLES)
Block 2
From folder (DOSORG)
Use this field to define the folder from which the record will be copied. The possible syntaxes are described in the dedicated appendix.
All folders (TOUDOS)
Use this option to copy the record to all the folders defined in the dictionary (ADOSSIER table of the current solution).
To folder (DOSDES)
Use this field to define the folder to which the record will be copied. The possible syntaxes are described in the dedicated appendix.
-
Run
Use this button to execute the current request. The execution triggers the update of a temporary table and links to the request display function, which is used to view the detail of the movements, but also to successively aggregate at the different break levels defined.
-
Display
Select this button to display your query's results in a grid.
Error messages
Other than the generic messages, the following error messages can appear when entering data:
Too many sort criteria
The request exceeds the allowed limits. The number of sort criteria cannot exceed 8.
Too many ranges
The request exceeds the allowed limits. The number of ranges cannot exceed 10.
Too many totals
The request exceeds the allowed limits. The number of totals cannot exceed 10.
Table not defined
A calculation formula was used in an expression that references fields from a table that is not linked.
xxx: Non-existent table
The table does not exist in the dictionary.
yyy: Non-existent field
The field does not exist in the dictionary.
Incorrect index
A field is indexed with a value that exceeds its dimension.
Impossible links
The links between the tables could not be established from the dictionary. This can indicate an error in the request, or you might need to explicitly define the links in detail under the Advanced tab.
This field has already been selected
An attempt was made to add a field to the selected fields, but this field already exists.
Unknown action
The Flash component triggered an action that is not recognized by the supervisor.
Impossible links. The fields must be of the same type.
You cannot create links between table fields of different types. For example, a numeric field cannot be linked to an alphanumeric key field.
Impossible link. Key component already entered.
When you create a link using a table’s key, links must also be established for all parts of that key. This message displays if you attempt to create a link on a field that is not part of the key.
Impossible link. Incomplete existing key.
The link was not defined for all fields in the key.
Impossible link. Non-existent key.
An attempt was made to set up a link on a field that does not belong to a key.
At least one description-type field and one value-type field are required to use this graph.
When the Graphical representation option is active, you need to select one field for the graph title and at least one other field for the graph calculations.
Data type not managed
You cannot use CLOB (text) and BLOB (image) fields in expressions for the selected fields.
Tables used
Refer to the implementation documentation.




