4D v12.4

ARRAY TO SELECTION

Home

 
4D v12.4
ARRAY TO SELECTION

 

ARRAY TO SELECTION 


 

ARRAY TO SELECTION ( array ; aField {; array2 ; aField2 ; ... ; arrayN ; aFieldN} ) 
Parameter Type   Description
array  Array in Array to copy to the selection
aField  Field in Field to receive the array data

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.

All the arrays must have the same number of elements. If the arrays are of different sizes, a syntax error is generated.

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)

 
PROPERTIES 

Product: 4D
Theme: Arrays
Number: 261

The command changes the current selectionDifferent in remote mode

 
HISTORY 

Modified: 4D v11 SQL

 
SEE ALSO 

SELECTION TO ARRAY
System Variables