4D v13

PV FIELDS LIST TO CELLS

Home

 
4D View v13
PV FIELDS LIST TO CELLS

PV FIELDS LIST TO CELLS 


 

PV FIELDS LIST TO CELLS ( area ; direction ; columns ; rows ; conversions ; master ; tables ; fields ) 
Parameter Type   Description
area  Longint in 4D View area
direction  Integer in 0 = Row; 1 = Column
columns  Longint array in Start cell column numbers array
rows  Longint array in Start cell row numbers array
conversions  Longint array in 0 = Original type; 1 = Set to text
master  Longint in Master table number
tables  Longint array in Table numbers
fields  Longint array in Field numbers

The PV FIELDS LIST TO CELLS command is the same as PV FIELD TO CELLS with multiple fields.

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

The columns and rows parameters contain the numbers of columns and rows of the starting cells respectively.

The fifth parameter, conversion, allows retyping the cell content as text. The source value type must be compatible with this operation: if you ask to retype a BLOB or picture to text, conversion will be ignored.

The tables and fields arrays contain the numbers of tables and source fields.

The command can be applied to related tables or to the master table using relations. The latter must be automatic and go from the master table to the table of the field to display, defined using the tables and fields arrays.

Unlike commands such as PV ADD DYNAMIC FIELDS, which maintain a dynamic relation with the database, modifications of values executed in the 4D View area after having been recuperated using the PV FIELDS LIST TO CELLS command are not executed in the records' content.

Example  

Again using the example for the PV FIELD TO CELLS command of an input form load for a record of the client table. This time, we will handle three fields simultaneously.

An automatic relation from the master contact table to the professional title table allows recuperating, in the ad hoc field of the latter, the title label of each contact from its title code saved as an integer (start field of the relation). We will display the third relevant column (column E since we are starting from Column C).

 C_INTEGER($Master`Master table number
 C_INTEGER($Index`Loop index
 
 $Master:=Table(->[Contacts]) `Master table number: contacts (for all columns)
 
 ARRAY LONGINT($ArrayColumns;3) `Start cell column number
 ARRAY LONGINT($ArrayRows;3) `Start cell row number
 ARRAY INTEGER($ConversionArray;3) `0 for original type or 1 for set to text
 ARRAY INTEGER($TablesArray;3) `Table numbers
 ARRAY INTEGER($FieldsArray;3) `Field numbers
 
 For($Index;1;3)
    $ArrayColumns{$Index}:=$Index+2 `Columns C to E
    $ArrayRows{$Index}:=2 `Start at the 2nd line
    $ConversionArray{$Index}:=0 `Keep original fields types
 End for
 
  `Tables and fields to get
 $TablesArray{1}:=Table(->[Contacts]) `Number of the contacts table
 $FieldsArray{1}:=Field(->[Contacts]ContactName) `Number of Name field
 
 $TablesArray{2}:=Table(->[Contacts]) `Number of the contacts table
 $FieldsArray{2}:=Field(->[Contacts]ContactFirstName) `Number of FirstName field
 
 $TablesArray{3}:=Table(->[Titles]`Number of title type table (related)
 $FieldsArray{3}:=Field(->[Titles]Label`Number of Label field (President, Secretary, Developer)
 
  `Getting corresponding contacts selection
 RELATE MANY([Clients]code)
 
  `Update the 4D View area with the Name, FirstName, and Title fields
 PV FIELDS LIST TO CELLS(Area;1;$ArrayColumns;$ArrayRows;$ConversionArray;$Master;
 $TablesArray;$FieldsArray)

 
PROPERTIES 

Product: 4D
Theme: PV Cell value
Number: 15907

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D View 6.8

 
SEE ALSO 

PV ADD DYNAMIC FIELDS
PV ARRAY TO CELLS
PV FIELD TO CELLS