Let's understand how RadCORE performs the tasks:


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.


2. Logical Deletion of Registration


If in your application you want records not to be physically deleted, just fill in the indicator below with the name of the field you use to control this.


ed_Table_Deleted_Field.Text := ''; 


Ex: ed_Table_Deleted_Field.Text := 'deleted';


Note: 

Note that you can enter the above definition as part of the "filter" we'll see below.



3. Specific Filter, Grouping and/or Ordering


When you need to filter the data from the current screen (for example, only the current company's records - see frmCadCLIENTES ) you add the information:


ed_Where_Search.Text := '' ; // WITHOUT THE WHERE CLAUSE


When you need to group some information in the standard grid search, define the field:


ed_Groupby_Search.Text := ''; // WITHOUT THE GROUP BY CLAUSE 

ed_Having_Search.Text := ''; // WITHOUT THE HAVING CLAUSE  


When you need to sort the default search on the grid, define the field:


ed_Order_Search.Text := ''; // SEM A Cláusula ORDER BY


4. Defining dynamic attributes for the default Search Grid

You can configure the attributes of the search GRID columns (see frmCadCLIENTES)


5. Filter by Date

When the current screen needs to be filtered by date range, uncomment this line and add the necessary information. (See frmCadCLIENTES)


6. inherited

At this point, the frmBaseCRUD FrameCreate event will be executed, passing all the above content to be processed. Study the code.


7. Filter fields

Add the fields you want to be displayed on the SEARCH tab.


8. Fields for Secondary Filter

Add the fields you want to be displayed on the SEARCH tab.


9. Private Code

Add your specific coding for the current screen here, when you need a specific business rule.

Created with the Personal Edition of HelpNDoc: Easily create HTML Help documents