OP Single query

4D - Documentation   Français   English   German   4D Open for 4D, Command Theme List   4D Open for 4D, Command Alphabetical List   Back   Previous   Next

version 1.5


OP Single query (connectionID; tableID; fieldID; queryOperator; queryValue; recordsFound) Longint

ParameterTypeDescription
connectionIDLongintConnection ID with target server
tableIDLongintNumber of the table in the database
fieldIDLongintNumber of the field in the table
queryOperatorStringQuery operator
queryValuePointerPointer to object containing query value
recordsFoundLongintNumber of records in the resulting selection
Function resultLongintError code result for the function

Description

OP Single query queries tableID for queryValues in fieldID. The query is performed on all the records in tableID. After the query, recordsFound indicates the number of records in the new current selection.

qureyValue is a pointer to a variable or field that contains the value with which to perform the query. This value can begin with, contain or end with the "@" symbol for wildcard queries. The pointer passed for queryValue can be a pointer to a field or a process or interprocess variable. If necessary, queryValue is converted.

To query on a Boolean field, you must pass "false" for False and "true" for True.

The query operators are as follows:

OperatorDescription
"="Equal
"#"Not equal
">"Greater than
">="Greater than or equal to
"<"Less than
"<="Less than or equal to

Error Codes

If OP Single query executes successfully, it returns 0. Otherwise, this function returns one of the following errors:

Error CodeDescription
-9969Invalid field type requested.
-9971Field number is out of range.
-9972Table number is out of range.
10128The 4D Open for 4th Dimension package
has not been initialized.
10136The connection does not exist.
10144The 4D pointer is equal to NIL.
10145A 4D pointer was expected.
10151Invalid search operator.
10153Unable to convert this type of data.
10154This command cannot be executed right now.

Example

This example searches for records in the [Invoices] table whose grand total is greater than 10,000.

   C_LONGINT(vRecords; $ErrCode)
   C_REAL(vValue)
   C_LONGINT(vTable;vField)

   vValue:=10000
   $errCode:=OP Get one field number (vConnectID;"[Invoices]Total";vTable;vField)
   $ErrCode:=OP Single query (vConnectID;vTable;vField;">";»vValue;vRecords)
   
   If ($ErrCode=0)
      ALERT(String(vRecords)+" record(s) were found.")
   End if 

See Also

OP Get one field number, OP Multi query, OP Single order by, ORDER BY.


4D - Documentation   Français   English   German   4D Open for 4D, Command Theme List   4D Open for 4D, Command Alphabetical List   Back   Previous   Next