version 1.5
OP Selection to array (connectionID; bindID{; tableID}) Longint
Parameter | Type | Description | |
connectionID | Longint | Connection ID with target server | |
bindID | Longint | Bind list ID | |
tableID | Longint | Number of the table in the database | |
Function result | Longint | Error code result for the function |
Description
OP Selection to array places the server fields into arrays. Both the server fields and the arrays are defined in bindID by using OP Define bind by pointer and/or OP Define bind by numbers.
Using OP Selection to array, you can retrieve data from a single target table, or you can retrieve data from a target table and its related tables. To retrieve data from a target file and its related tables:
The target table must be a Many table and the related table must be a One table.
The relation must be automatic.
The tables/fields to be retrieved from the target table and the related table must be in the same bind list.
tableID is the table number of the target table. If you omit this parameter or pass 0, the table number of the first table/field couple in the bind list is used as the target table.
Retrieving records across relations
Consider the following structure:
Case 1
Suppose you want to retrieve the [Invoices]Invoice ID, [Invoices]Invoice Date, [Invoices]Invoice Total, [Customers]Company, and [Customers]City fields, in this order. You retrieve fields from the two tables using a relation, so the target table must be the Many table, in this case [Invoices]. Because the first field is from this table, you just need to build the bind appropriately, and you can omit the target table.
Case 2
Suppose you want to retrieve the [Customers]Company and [Customers]City fields based on the selection in the [Invoices] table. You need to build the bind appropriately, and you have to pass [Invoices] as the target table. Here, you do not retrieve fields from the [Invoices] table even though you use it as the target table.
Error Codes
If OP Selection to array executes successfully, it returns 0. Otherwise, this function returns one of the following errors:
Error Code | Description |
-108 | Not enough memory to perform this operation. |
-9969 | Invalid field type requested. |
-9971 | Field number is out of range. |
-9972 | Table number is out of range. |
10128 | The 4D Open for 4th Dimension package has not been initialized. |
10135 | Invalid parameter type. |
10136 | The connection does not exist. |
10137 | The context does not exist. |
10139 | The context is not defined. |
10153 | Unable to convert this type of data. |
10154 | This command cannot be executed right now. |
Example
See the example for OP Array to selection .
See Also
OP Define bind by numbers, OP Define bind by pointer, OP Selection to array, SELECTION TO ARRAY.