1

1. Prepare the sqlMaster and sqlSearchMaster
Every form of registration needs a SELECT containing the information that will be manipulated.
Some can have 2, 3 ... 5 or several fields.
RadCORE brings a Joker concept [[yyyy]] to try to streamline the construction of these queries.
The wildcard [[fields]] will be replaced at runtime by the DATAFIELD of each DBWARE component present in the form of the table linked to dsMaster.
Ex:
If you have 3 fields in your form ( id, name, total ), [[fields]] will be replaced by those 3 fields.
If you need the select to receive additional fields that are not in the form, you can add it normally by adding a comma after the [[fields]] and so on or create in the form "hidden fields"
(Ex: frmCadCLIENTES, component "edHiddenCompanyID" )
Note: when a component is without the DATASOURCE populated, radcore will by default link to "dsMaster".
You can already see that if you have 100 fields, you won't need to type any, all will be added dynamically.
The [[table]] wildcard will be replaced by the name of the table linked to that form.
This information comes from the assembly of the item in the menu.
Note that, to avoid errors, the alias tab is added to the main SELECT table.
The wildcard [[pk]] will be replaced by the PRIMARY KEY field in the table. This process is compatible with several DBMS.
By default, the primary key will not be displayed in the search grid. For it to be displayed use [[pk-show]]
The parameter ":table_pk" will be used to filter only the record selected in the SEARCH tab.
The [grid] wildcard is only used as a delimiter.
To take advantage of lines of code, we insert 2 queries into one.
Select BEFORE [grid] is used for sqlMaster and afterwards it will be used for sqlSearchMaster.
It is also possible to define the number of records that will be presented in the first run.
The wildcard [[allpks]] was used in this example because we are using aliases. ([[pk]] as "CÓDIGO" )
It is not necessary to use [[allpks]] if you have not created an ALIAS different from your original PK name.
The application of this wildcard will be used in forms inherited from frmBaseCRUDDetail where it is not necessary to display the PK (master code) on the grid but it is necessary to mount the select with it.
Everything is done dynamically. A detailed study of this process is highly recommended.
Finally, this way of generating SELECTs has the advantage of being reused for virtually every screen you create.
You only need to insert extra fields when necessary, but most of the work is defined.
Analyze the code of other RadCORE screens and see the differences. Run, debug to better understand.
Created with the Personal Edition of HelpNDoc: Full-featured EBook editor