OP Selection to array

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 Selection to array (connectionID; bindID{; tableID}) Longint

ParameterTypeDescription
connectionIDLongintConnection ID with target server
bindIDLongintBind list ID
tableIDLongintNumber of the table in the database
Function resultLongintError 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 CodeDescription
-108Not enough memory to perform this operation.
-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.
10135Invalid parameter type.
10136The connection does not exist.
10137The context does not exist.
10139The context is not defined.
10153Unable to convert this type of data.
10154This 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.


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