4D v13.4ARRAY TO SELECTION |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v13.4
ARRAY TO SELECTION
ARRAY TO SELECTION
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. When you pass the * parameter, 4D does not execute the corresponding statement line immediately but instead stores it in memory; this way you can stack several lines ending with an *. All of these lines awaiting execution are executed by one final ARRAY TO SELECTION statement that does not have the * parameter. For this reason, the command can now be called without any parameters. 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. 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) This example duplicates a selection of records: ARRAY TEXT(a1;0) |
PROPERTIES
Product: 4D
INDEX HISTORY
SEE ALSO
SELECTION TO ARRAY |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||