4D v13.4SET QUERY DESTINATION |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v13.4
SET QUERY DESTINATION
SET QUERY DESTINATION
SET QUERY DESTINATION enables you to tell 4D where to put the result of any subsequent query for the current process. You specify the type of the destination in the parameter destinationType. 4D provides the following predefined constants, found in the "Queries" theme:
You specify the destination of the query itself in the optional destinationObject parameter according to the following table:
SET QUERY DESTINATION(Into current selection) The records found by any subsequent query will end up in a new current selection for the table involved by the query. With: SET QUERY DESTINATION(Into set;"mySet") The records found by any subsequent query will end up in the set "mySet". The current selection and the current record for the table involved by the query are left unchanged. Note: In client/server, you cannot use local/client sets (name preceeded by $ symbol) as a query destination. This type of set is created on client machines when queries are executed on the server. For more information on these types of sets, refer to the Sets section. With: SET QUERY DESTINATION(Into named selection;"myNamedSel") The records found by any subsequent query will end up in the named selection "myNamedSel". The current selection and the current record for the table involved by the query are left unchanged. Notes:
SET QUERY DESTINATION(Into variable;$vlResult) Or: SET QUERY DESTINATION(Into variable;"";->$vlResult) The number of records found by any subsequent query will end up in the variable $vlResult. The current selection and the current record for the table involved by the query are left unchanged. Warning: SET QUERY DESTINATION affects all subsequent queries made within the current process. REMEMBER to always counterbalance a call to SET QUERY DESTINATION (where destinationType#0) with a call to SET QUERY DESTINATION(0) in order to restore normal query mode. SET QUERY DESTINATION changes the behavior of the query commands only:
On the other hand, SET QUERY DESTINATION does not affect other commands that may change the current selection of a table such as ALL RECORDS, RELATE MANY and so on. You create a form that will display the records from a [Phone Book] table. You create a Tab Control named asRolodex (with the 26 letters of the alphabet) and a subform displaying the [Phone Book] records. Choosing one Tab from the Tab Control displays the records whose names start with the corresponding letter. In your application, the [Phone Book] table contains a set of quite static data, so you do not want to (or need to) perform a query each time you select a Tab. In this way, you can save precious database engine time. To do so, you can redirect your queries into named selections that you reuse as needed. You write the object method of the Tab Control asRolodex as follows: ` asRolodex object method The Unique values project method in this example allows you to verify the uniqueness of the values for any number of fields in a table. The current record can be an existing or a newly created record. ` Unique values project method After this project method is implemented in your application, you can write: ` ... |
PROPERTIES
Product: 4D
INDEX HISTORY
SEE ALSO
GET QUERY DESTINATION |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||