KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Queries and Selections
PRODUCT: 4D | VERSION: 13.3 | PLATFORM: Mac & Win
Published On: December 16, 2013

The QUERY command takes in two parameters. The first is the target table that will be queried. The second is the query argument. The query will be performed on all the records of the target table. The results of the query will be placed in a selection. By default, the selection will be the current selection. You can change the query destination by using the command SET QUERY DESTINATION.

//Creates a selection with all the table IDs greater than 10
QUERY([Table];[Table]ID>10)

//Creates a selection with all the table IDs less than 15
QUERY([Table];[Table]ID<15)


If you want to limit the query to just the current selection instead of all records in the target table, use the command QUERY SELECTION.
//Creates a selection with all the table IDs greater than 10
QUERY([Table];[Table]ID>10)

//Creates a selection with all the table IDs less than 15 and greater than 10
QUERY SELECTION([Table];[Table]ID<15)


The * parameter can be used at the end of the QUERY command to concatenate queries.
QUERY([Table];[Table]ID>10;*)
QUERY([Table];[Table]ID<15)
//Creates a selection with all the table IDs greater than 10 and less than 15