1 Catalogued SQL queries
The query request must exists registered in the catalogue of a backend database dictionary, or within the master Wic.
Each query consists of two parts: a code naming the quey itself and a statement.
The Frontend always invokes the query by its code, and the underlying statement is executed, at the backend side.
As results, the dataflow prevents the transaction against the execution of arbitrary code, delivered from the client side.
Queries can have filtering parameters and variables. The filtering and output columns of the query are defined in the object wic_sqlc_object_out while variables are stored in wic_sqlc_object_colvar .
The filtering condition is constructer upon the column marked are filterable and the data sent by the client and is automatically added to the query. If the WHERE clause already contains conditions the system will look for the string $0 and will replace with the condition:
... <where> geanmovh.refter ='A' AND $0 </where>
Variable conditions allow more control over the conditions of the query. Variables are replaced using the ${VARNAME} notation. Each of the declared variables will be replaced using the value sent from the client, for instance:
... <where> geanmovh.refter = ${codlab} AND geanmovh.fecmov between ${fecini} AND ${fecfin} </where>
When a query has filtering columns or variabled defined, then in the client side an form will appear to allow to input of the filtering values
wic_sqlc_object | |
---|---|
Label | Description |
Code | Record identifier code |
Information | Information of the object |
SQL query | SQL query to execute |
Cache | indicates if the select can be cached
|
Created by |
|
Date created |
|
Modified by |
|
Date updated |
|
1.1 Output columns and search options(wic_sqlc_object_out)
By defining output columns, a columns name can be mapped (product of an SQL/XSQL operation) to it's corresponding table name. This allows the system to identify column properties such as labels, includes.. etc that are associated with a table/column pair.
It is possible to define the visibility of a column or set a column to perform grand total sums.
It is also possible to define whether or not a column is filterable, the filter is required or the filter must perform exact matching. When a column is set to be filterable, an form box with the filterable fields appear at the left side of the table.
Here the information about each column is being defined. Information such as the label description, type and if or if not the column has includes.
It might happen that a column of the SQL does not have the same name of the table where its information is saved (due to the use of alias or because the column has the properties of a fk column and the information had not been duplicated.
On these situations the Real Table and the Real column data are telling us the name of the column in the SQL, while the Table and the Column are giving us the information about where to get the data related to the column.
The information found here will also indicate which columns must be filtered mandatorily, which can be filtered and which ones can't and the filtration method (exact filtering or not).
Here it is also possible to indicate if a column should or should not be visible.
wic_sqlc_object_out | |
---|---|
Label | Description |
Identifier | ID of the SQL call |
Order | Order of columns |
Table | Table name of the column to find the table information |
Real table | Table name of the table where to get the label |
Column | Column name of the output. |
Real column | Name of the column in the database when searching for the column data. Only needed if the column name in the SQL is not the same than the name at the database |
Filtrable | Tells if the column is filterable
|
Filtre Required | Tells if the filter is required or not
|
Exact filter | Indicates if this column is filtered with an equality or with a LIKE(%SOMETHING%)
|
Total | Show a summation of the column data. Only if numeric data
|
Hide column | Hide the column
|
Link type | Type of link, internal or external
|
Link | Link |
Condition | Link condition |
1.2 Variables (wic_sqlc_object_colvar)
At the Variables, we can create variables that can be used to build the query.
wic_sqlc_object_colvar | |
---|---|
Label | Description |
ID | ID of the SQL call |
Order | Variable request order |
Variable | Variable code |
Table | Table from which obtain the description |
Description | Variable description |
Type | Variable type
|
Values | Variable default values |
A variable is defined by its name, the code of the SQL catalogued at which it does reference and its type. Moreover, each variable may have some extra parameter such as a default value a label description and a table from where to get even extra data related to the variable like includes.