Command PV ADD DYNAMIC ARRAYS

4D View

PV ADD DYNAMIC ARRAYS

version 6.8


PV ADD DYNAMIC ARRAYS (area; array)

ParameterTypeDescription
areaLongint4D View area
arrayString ArrayArray containing names of array

Description

The PV ADD DYNAMIC ARRAYS command adds in area a block of rows corresponding to the values of arrays whose names are passed using the array parameter, starting from the cell A1.

The arrays must all contain the same number of elements and are always presented vertically (as columns). The first array is displayed in the column A, the others in columns located to its right.

Note: If a dynamic field area was already inserted in the 4D View area using the PV ADD DYNAMIC FIELDS command, it is deleted and replaced by the dynamic arrays.

PV ADD DYNAMIC ARRAYS maintains a dynamic link with the arrays attached the dynamic portion of the area. As a result, modifications of values assigned in a 4D View area will be reflected within each array and vice versa. Deleting or adding elements in the 4D array will also be reflected within the area.

You cannot set several dynamic portions in the same 4D View area.

Notes:

• 4D array(s) and 4D View area must be defined in the same process.

• Dynamic data update is not available between the records displayed in the 4D forms and 4D View external windows. To reflect in a 4D View window a modification carried out in the 4D record, you need to redraw the window using the PV REDRAW command (modifications executed through 4D commands are automatically reflected into 4D View areas).

Example

The following example get the names of contacts related to the current record of the clients table in an array, then displays the content in a 4D View area included in the input form of the client being modified.

Modifications executed by the user will be directly reflected in the 4D arrays, that we will have to next manage, for example, by updating the selection of recorded contacts.

   ARRAY TEXT(NamesArray;0)  `Contact names array
   ARRAY TEXT(FirstnamesArray;0)  `Contact first names array
   ARRAY STRING(31;$ArrayArrays;2)  `Arrays name array

   $ArrayArrays{1}:="NamesArray"  ` First dynamic column
   $ArrayArrays{2}:="FirstnamesArray"  ` Second dynamic column

   RELATE MANY([Clients]Code)  `Get linked contacts
   SELECTION TO ARRAY([Contacts]ContactName;NamesArray;[Contacts]ContactFirstname;FirstnamesArray)

   PV ADD DYNAMIC ARRAYS (Area;$ArrayArrays)

See Also

PV ADD DYNAMIC FIELDS, PV CLEAR DYNAMIC COLUMNS, PV SET CELL VARIABLE.