ARRAY TO SELECTION

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 3


ARRAY TO SELECTION (array; field{; array2; field2; ...; arrayN; fieldN})

ParameterTypeDescription
arrayArrayArray to copy to the selection
fieldFieldField to receive the array data

Description

The ARRAY TO SELECTION command copies one or more arrays into a selection of records. All fields listed must belong to the same table.

If a selection exists at the time of the call, the elements of the array are put into the records, based on the order of the array and the order of the records. If there are more elements than records, new records are created. The records, whether new or existing, are automatically saved.

If the arrays are of different sizes, the first array is used to determine how many elements to copy. Any additional arrays are moved into the field that follows each array name.

This command does the reverse of SELECTION TO ARRAY. However, the ARRAY TO SELECTION command does not allow fields from different tables, including related tables, even when an automatic relation exists.

WARNING: Use ARRAY TO SELECTION with caution, because it overwrites information in existing records. If a record is locked by another process during the execution of ARRAY TO SELECTION, that record is not modified. Any locked records are put into the process set called LockedSet. After ARRAY TO SELECTION has executed, you can test the set LockedSet to see if any records were locked.

4D Server: The command is optimized for 4D Server. Arrays are sent by the client machine to the server, and the records are modified or created on the server machine. As such a request is handled synchronously, the client machine must wait for the operation to be completed successfully. In the multi-user or multi-process environment, any records that are locked will not be overwritten.

Example

In the following example, the two arrays asLastNames and asCompanies place data in the [People] table. The values from the array asLastNames area placed in the field [People]Last Name and the values from the array asCompanies are placed in the field [People]Company:

   ARRAY TO SELECTION (asLastNames;[People]Last Name;asCompanies;[People]Company)

See Also

SELECTION TO ARRAY.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next