A newly-called mask is empty. There are two possibilities to fill it with records:
The figure shows the functional sequence for a database search for a certain kind of records. You see the participating functions, the states the mask takes and the triggers it sets off. The NoSelect function iwf_sel_lis (search) is the triggering function. If you install your own individual userexits at the Edit_, Pre_ or Post_Action trigger, e.g. to perform special queries or checks within the functional sequence, you can evaluate the default parameter pr1 automatically passed by triggers. It informs about the current internal work mode of the mask (here only Q for Query).
If you use the optional userexit wdh_upd_lis as NoSelect function for iwf_sel_lis, users can fill the mask with all records without having to enter any search criteria in the search line. However, it is a precondition that no old search terms still exist in the search line (e.g. from a previous search). In order to automatically fill a mask with all records immediately after the call you can call wdh_upd_lis at the Pre_Mask trigger.
Note! In case of data queries without a search criterion you always should define the maximum number of loadable records for the mask (field maxi. record in the mask master). Else DataView may load thousands of records into local memory.
A query consists of search terms. Search terms can be entered in one or several fields of the search line. Search terms in several fields are automatically combined by UND. A search term can contain the following operators and special characters:
Comparison operators (for field types: String, Integer, Float, Money, Date):
Combination operators (for all field types):
Replacement characters (wildcards):
Replacement characters | Comment |
% | Replaces no or any number of unknown characters |
? | Replaces exactly any one unknown character |
Exprexssion | Comment |
" (2 single quotation marks) | Query for ZERO values |
'Expression' | query for an expression containing spaces |
If you do not enter any search terms (empty fields in the search line), DataView will fetch all records (just as standard function Refresh).
Comparison and combination operators can be re-assigned in your application. To do so you globally or user-specifically assign different values to the default variables QUERYAND, QUERYGREATER, QUERYLESS, QUERYNOT or QUERYOR.
Wildcards can be globally or user-specifically and reassigned with the help of the default variable WILDCARD. You can also use the function epqwcd ('p1', 'p2')
from within the program for that purpose. The first parameter sets the wildcard for a single character, while the second parameter stands for the wildcard for a string. For wildcards you should only use characters that do not - or only rarely - appear in texts. Always avoid the character '_'
(underscore). Using it would result in performance losses during queries.
Case-Sensitivity of search terms in fields of the query line depends on the value specified for the default variable QUERYMODE (MIXED, SENSITIVE or INSENSITIVE). The default value is INSENSITIVE. Additionally, you can set a -> field-specific case-sensitivity for individual fields in the Mode field of the field master. This overrides the QUERYMODE setting.
The maximum length of search terms in fields of the search line depends on the value specified for the default variable QUERYSIZE. The default value is 100, the maximum number is 256.
Installed field selection tools, such as -> modal window or -> choice boxes are also active in Query mode. They can be used to select search terms if users have no idea which terms they could search for or if only certain search terms are to be used.
By specifying a Join condition in the Join Definition field of the mask master (sub-form Additional Attributes) you can preselect data in the mask or make a query dependent on data in other tables, without existing relations or links to these tables in the data model. DataView automatically adds the Join condition entered to the Where condition created by the search string in the search line (& combination), forms an internal search string and transmits it unchecked to the database.
The possible comparison operators are =, !, <, >. Several Join conditions can be combined with &. The total entry may not contain any spaces.
Some examples for pre-selections or joins:
Mask joins to mask components or to sub-forms are automatically appended to the mask join of the superordinate mask. Please note that you cannot use the procedures for performance optimisation in combined forms if you use sub-forms with mask joins.
Query results can be automatically sorted in the database and only then loaded into the mask.
The sort identifier can be set for each field in the mask in the Order field of the mask-field relation.
Sort Identifier | Order |
n | Numerically or alphabetically ascending |
-n | Numerically or alphabetically descending |
0 | Unsorted |
n is a number and determines the value of the field in the sort hierarchy. 1 means highest priority.
The sorting mask is used to allow users to change the sort identifier before a query. It is opened for the active field via [Ctrl+O] in masks. At run-time this entry overwrites the value defined in the mask-field relation.
For application specific calls of the sort mask the event macro @MODIFY-SORT is available in MAS state.
Note! Sort IDs different from 0 can result in long response periods. Especially in case of fuzzy queries that might lead to a high number of records as query results (ca. > 0) local sorting should be preferred instead.
You can limit the number of records that are loaded into the mask after a query. Thus you make sure that after a very general query the local memory does not run over. The limitation is set in the R-max of the mask master. More than 0 records should never be loaded into a mask.
If a database query returns a number of records higher than the maximum value defined for the mask (R-max field in the mask master), You can successively load the remaining records. For this purpose a record scan button will appear below the vertical scroll bar. As soon as the last records have been loaded, the button will disappear. In forms you scan via [Shift+Ctrl+F]. It is a precondition for the record scan that the query was started with a database sort criterion set for at least one field.
For application-specific calls of the record scan the standard menu userexit wdh_nxt_lis is available.
In case of database queries a previously active record (identified by row pointer in lists or the one displayed in forms) will remain active if it is part of the search result.
If the header form of a combined form is set to Query mode of Mask-Edit state via iwf_sel_lis, all sub-masks (in case of sub-masks on index cards only the currently displayed one) will automatically be in that state. This enables a combined search. For instance you can search in an item form with a suppliers sub-list for an item with a certain supplier.
If you defined an event in your application that triggers data searches via iwf_sel_lis, searching is possible in each active mask, as opposed to mask-specific items or buttons defined for that. In order to lock search functions for individual masks you can install cch_nop_que at the Edit_Action trigger of this mask. This userexit prevents all query operations.