Application icon

Issue Database Query

This function is used to issue a query against an open query database.

Click here for information on identifying an open database.

If Use previous results is not selected, the entire database is queried. If Use previous results is selected, you must specify a named variable containing the results of a previous query. When specified, the new query is applied over the previous results as opposed to the entire database. With this mechanism you can build complex queries by successive calls.

The results of the query are placed into the specified named variable. The results comprise a list of keys separated by a \~ sequence. The keys are suitable for accessing items in the database. You can enumerate the results of a query via a Repeat With statement. Note, if the database was opened Keyless, each result will take the absolute row index format: #row number. Note that the results set, when Keyless can be invalidated if a row is added or removed.

If any matches were made in response to the query, the action test state will be set to true. If no matches were found, the action test state will be set to false.

You can specify which column you want to access symbolically or numerically. A symbolic name must exactly match the name (case sensitive) of one of the database columns or all action processing will be terminated. When a query database is first opened the names of the columns are placed in a list in the Query Database -Names named variable. Numeric specifications are numbered left to right from zero. In the rare case that you have a column with a numeric name, simply leave a space in front of the number to force the symbolic lookup.

You choose a test type and data to apply the test against for each record taking part in the query. The Case Insensitive option is ignored unless a Text test is chosen. The Match Words option is ignored unless a Starts With, Ends With or Contains test is chosen. For the purposes of this function a match whole word test fails if:

the first character in the from pattern is alphanumeric and the character preceding the match is alphanumeric.
   or if:
the last character in the from pattern is alphanumeric and the character following the match is alphanumeric.

All text fields may contain any of the escape sequences described in Escape Sequences.

The statement is only executed once for all execution modes.