4D v14.3

CREATE SELECTION FROM ARRAY

Home

 
4D v14.3
CREATE SELECTION FROM ARRAY

CREATE SELECTION FROM ARRAY 


 

CREATE SELECTION FROM ARRAY ( aTable ; recordArray {; selectionName} ) 
Parameter Type   Description
aTable  Table in Table from which to create the selection
recordArray  Longint, Boolean array in Array of record numbers, or Array of booleans (True = the record is in the selection, False = the record is not in the selection)
selectionName  String in Name of the named selection to create, or Apply the command to the current selection if the parameter is omitted

The CREATE SELECTION FROM ARRAY command creates the named selection selectionName from:

  • either an array of absolute record numbers recordArray from aTable,
  • or an array of Booleans. In this case, the values of the array indicate the belonging (True) or not (False) of each record in table to selectionName.

If you don’t pass selectionName or if you pass an empty string, the command will be applied to the current selection, which will then be updated.

When you use a Longint array with this command, all the numbers of the array represent the list of record numbers in selectionName. If a number is incorrect (record not created), error -10503 is generated.

Note: Be careful, you must make sure that the array does not contain any lines that have the same value, otherwise the resulting selection will be incorrect.

When you use a Boolean array with this command, the Xth element of the array indicates if the record number X is (True) or is not (False) in selectionName. The number of elements in recordArray must be equal to the number of records in table. If the array is smaller than the number of records, only the records defined by the array can make up the selection.

Note: With an array of booleans, the command uses elements from numbers 0 to X-1.

Warning: A named selection is created and loaded into memory. Therefore, make sure that you have enough memory before executing this command.

If a record number is invalid (record not created), the error -10503 is generated. You can intercept this error using a method installed by the ON ERR CALL command.

 
PROPERTIES 

Product: 4D
Theme: Named Selections
Number: 640

This command modifies the Error system variableThe command changes the current selection

 
HISTORY 

Modified: 4D v6.7

 
SEE ALSO 

CLEAR NAMED SELECTION
COPY NAMED SELECTION
CREATE SET FROM ARRAY
Identifiers
LONGINT ARRAY FROM SELECTION
USE NAMED SELECTION

 
ARTICLE USAGE

4D Language Reference ( 4D v12.4)
4D Language Reference ( 4D v11 SQL Release 6)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v13.5)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)