Command PV ARRAY TO CELLS

4D View

PV ARRAY TO CELLS

version 6.8


PV ARRAY TO CELLS (area; direction; column; row; conversion; array)

ParameterTypeDescription
areaLongint4D View area
directionInteger0 = Row; 1 = Column
columnLongintStart column number
rowLongintStart row number
conversionInteger0 = Set to text; 1 = Original type
arrayArrayArray name

Description

The PV ARRAY TO CELLS command inserts in area the content of arrays whose names are specified in the array array. The content is inserted from coordinates defined by column and row, in the direction defined by direction.

Note: Using the direction parameter is different from the direction parameter in the PV GOTO NEXT CELL and PV GET NEXT FREE CELL, where the direction can be in any direction. For PV ARRAY TO CELLS, the direction is either to the right (0 = row), or toward the bottom (1=column).

The fifth parameter, conversion, allows changing the data type of the cell contents that will end up as text. The type of source value must be compatible with this operation: if you request a data type change of a BLOB or a picture to text, conversion will be ignored.

Example

Re-copy, toward the bottom, three arrays of different types from the current cell. Depending on the response to the type change confirmation dialog box, the array content can be executed in 4D View cells in the converted (text) form or not.


   C_INTEGER($Index)  `Loop index
   C_LONGINT($Column;$Row)  `Start cell coordinates
   C_INTEGER($Conversion)  `Force conversion to text?

   ARRAY STRING(20;$ArrayString;10)  `Array of alphanumeric values (start at current cell)
   ARRAY DATE($ArrayDates;10)  `Array of dates (next column)
   ARRAY BOOLEAN($ArrayBooleans;10)  `Array of booleans (third column)

        `Initialization
   For ($Index;1;Size of array($ArrayString))
        $ArrayString{$Index}:=String($Index*10)  `"10", "20", "30"...
        $ArrayDates{$Index}:=Current date(*)+$Index  `25/06/2001, 26/06/2001...
        $ArrayBooleans{$Index}:=($Index%2=0)  `True = even
   End for

   PV GET CURRENT CELL (Area;$Column;$Row)

   CONFIRM("Would you like to convert the arrays content to text?")
   $Conversion:=1-OK

        `To obtain the columns "$ArrayString", "$ArrayDates" and "$ArrayBooleans" :
   PV ARRAY TO CELLS (Area;1;$Column;$Row;$Conversion;$ArrayString)  `1 = toward the bottom
   PV ARRAY TO CELLS  (Area;1;$Column+1;$Row;$Conversion;$ArrayDates)
   PV ARRAY TO CELLS  (Area;1;$Column+2;$Row;$Conversion;$ArrayBooleans)

See Also

PV CELLS TO ARRAY, PV FIELD TO CELLS.