KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Remember to use eQO_NoOperator when building a Query with the API
PRODUCT: 4D | VERSION: 6.7 | PLATFORM: Mac & Win
Published On: August 10, 2001
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

When using the 4D API calls to build a query a common mistake is to leave out the eQO_NoOperator operator on the first line of a query.

The basic syntax of a query series is to open the query (PA_OpenQuery), call a series of query commands (PA_QueryXXX) and then execute the query with a close query command (PA_CloseQuery). When calling the query commands such as PA_QueryLongint, the first time a query call is made the eQO_NoOperator must be called. This is to let the API know that this is in fact the first query call. All subsequent Query calls will use operators such as eQO_LogicalAND, eQO_LogcialOR, or eQO_Except .

For example, suppose that we want to query on a table and find all the values that range from 1,000 to 10,000. Our example syntax would be similar to the following:

PA_OpenQuery(TableNum);

PA_QueryLongint(TableNum, FieldNum, eQO_NoOperator, eQC_IsGreaterOrEqual, 1000);

PA_QueryLongint(TableNum, FieldNum, eQO_LogicalAND, eQC_IsLessOrEqual, 10000);

PA_CloseQuery;

Notice that the first time we call PA_QueryLongint we must call the eQO_NoOperator operator.