PV CELLS TO ARRAY

4D - Documentation   Français   English   German   4D View 2003, Command Theme List   4D View 2003, Command Alphabetical List   4D View 2003, Constant Theme List   Back   Previous   Next

version 6.8


PV CELLS TO ARRAY (area; direction; axis; start; array; number)

ParameterTypeDescription
areaLongint4D View area
directionInteger0 = Row; 1 = Column
axisLongintRow or column number
startLongintStart cell number
arrayArrayArray name
numberLongintNumber of cells

Description

The command PV CELLS TO ARRAY fills the array with the cell content specified by axis, direction, start and number.

direction specifies if the PV CELLS TO ARRAY command must execute a copy of continuous cells in the horizontal (0) or vertical (1) direction. Depending on the value of direction, the axis parameter indicates or row or column number.

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 CELLS TO ARRAY, the direction is either to the right (0 = row), or toward the bottom (1=column).

Example

Take, for example, a 4D View area included in the input screen of the client table: this included area, containing 10 rows maximum, will serve to enter or modify client contacts. The entry area is composed of 10 cells disposed in columns from the current cell:

   ARRAY STRING(255;ContactsTab;0)  `Contact name array
   C_LONGINT($Column;$Row)  `Coordinates of starting cell

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

      `10 rows maximum from the current cell toward the bottom
   PV CELLS TO ARRAY (Area;1;$Column;$Row;ContactsTab;10)

   If (Size of array(ContactsTab)#0)  `Was anything recuperated?      
      RELATE MANY([Clients]Code)  `Get linked records
      DELETE SELECTION([Contacts])  `Purge existing ones
         `Update contacts (new, modified or deleted)
      ARRAY TO SELECTION(ContactsTab;[Contacts]ContactName)  `Create contacts
      APPLY TO SELECTION([Contacts];[Contacts]CodeClient:=[Clients]Code)  `To keep the relation
      QUERY SELECTION([Contacts];[Contacts]ContactName="")  `Purge empty contacts
      DELETE SELECTION([Contacts]) 
   End if 

See Also

PV ARRAY TO CELLS, PV FIELD TO CELLS.


4D - Documentation   Français   English   German   4D View 2003, Command Theme List   4D View 2003, Command Alphabetical List   4D View 2003, Constant Theme List   Back   Previous   Next