4D v13.4

QUERY BY EXAMPLE

Home

 
4D v13.4
QUERY BY EXAMPLE

QUERY BY EXAMPLE 


 

QUERY BY EXAMPLE ( {aTable}{;}{*} ) 
Parameter Type   Description
aTable  Table in Table for which to return a selection of records, or Default table, if omitted
Operator in If passed, the scrolling bar will not be displayed

QUERY BY EXAMPLE performs the same action as the Query by Example menu command in the Design environment. It displays the current input form as a query window. QUERY BY EXAMPLE queries aTable for the data that the user enters into the query window. The form must contain the fields that you want the user to be able to query. The query is optimized; indexed fields are automatically used to optimize the query.

See the 4D Design Reference manual for information about using the Query by Example menu command in the Design environment.

Example  

The method in this example displays the MyQuery form to the user. If the user accepts the form and performs the query (that is, if the OK system variable is set to 1), the records that meet the query criteria are displayed:

 FORM SET INPUT([People];"MyQuery") ` Switch to query form
 QUERY BY EXAMPLE([People]` Display form and perform query
 If(OK=1) ` If the user performed the query
    DISPLAY SELECTION([People]` Display the records
 End if

If the user clicks the Accept button or presses the Enter key, the OK system variable is set to 1 and the query is performed. If the user clicks the Cancel button or presses the “cancel” key combination, the OK system variable is set to 0 and the query is canceled.

 
PROPERTIES 

Product: 4D
Theme: Queries
Number: 292

The OK variable is changed by the commandThis command changes the currrent recordThe command changes the current selectionNot for server

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: < 4D v6

 
SEE ALSO 

ORDER BY
QUERY