KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: New 4D v6.5 QUERY WITH ARRAY command
PRODUCT: 4D | VERSION: | PLATFORM:
Published On: August 28, 1999

4D v6.5 adds a new command that makes writing code to search for multiple criteria much simpler. With the QUERY WITH ARRAY command it takes just 2 parameters, the field to query and an array of values to search, to find all records that equal any one of the values in the array.
The old way of searching:

compared to:

Cut and Paste the following code example into your own 4D project:

QUERY([Table1];[Table1]Country="France";*) QUERY([Table1]; | ;[Table1]Country="Ireland";*) QUERY([Table1]; | ;[Table1]Country="England";*) QUERY([Table1]; | ;[Table1]Country="Spain";*) QUERY([Table1]; | ;[Table1]Country="Italy";*) QUERY([Table1]; | ;[Table1]Country="Germany")

ARRAY STRING(6;SearchArray;10)
SearchArray{1}:="France"
SearchArray{2}:="Ireland"
SearchArray{3}:="England"
SearchArray{4}:="Spain"
SearchArray{5}:="Italy"
SearchArray{6}:="Germany"
QUERY WITH ARRAY([Table1]Country;SearchArray)