Command PV FIELD TO CELLS

4D View

PV FIELD TO CELLS

version 6.8


PV FIELD TO CELLS (area; direction; column; row; conversion; master; table; field)

ParameterTypeDescription
areaLongint4D View area
directionInteger0 = Row; 1 = Column
columnLongintStart cell column number
rowLongintStart cell row number
conversionInteger0 = Original type; 1 = Set to text
masterIntegerMaster table number
tableIntegerTable number
fieldIntegerField number

Description

The PV FIELD TO CELLS command inserts in area the values of field corresponding to the current selection of the master table. Insertion starts from the cell defined by the column and row coordinates, 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 FIELD TO CELLS, the direction is either to the right (0 = row), or toward the bottom (1=column).

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 command can be applied to a table linked to a master table using a relation. The latter must be automatic (type) and go from the table defined by master to the table defined by table containing the field to display. In the traditional example of invoices and invoice rows, it allows recuperating the content of a field from a table of rows, but also from the invoice table relating to a selection of the invoice table rows (master table).

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

Example

In the PV CELLS TO ARRAY command example, we updated the contacts table once they were entered into a 4D View area included in a client input form. Here, we will update the included area during the On Load form event, in other words, during the load of the input form being modified.

An automatic relation of the master contact table to the professional title table (President, Secretary, Developer) allows recuperating, in the ad hoc field for the latter, the label of the professional title for each contact from its title code saved as an integer (starting field of the relation). We will display the contact name and its title in two columns.

   C_INTEGER($Master)  `Master table number
   C_INTEGER($Table)  `Table number
   C_INTEGER($Field)  `Field number
   C_LONGINT($Column;$Row)  `Coordinates of starting cell

   $Master:=Table(->[Contacts])  `Master table number: contacts (for the two columns)
   RELATE MANY([Clients]code)      `Get the corresponding contacts from the selection
   PV GET CURRENT CELL (Area;$Column;$Row)

        `Update the 4D View area for names
   $Table:=Table(->[Contacts])  `Number of the contacts table
   $Field:=Field(->[Contacts]ContactName)  `Number of field whose content will be retrieved
        `Conversion not necessary, we will retrieve from the alphanumeric
   PV FIELD TO CELLS  (Area;1;$Column;$Row;0;$Primary;$Table;$Field)

        `Update the 4D View area for titles
   $Table:=Table(->[Titles])  `Number of the title type (related) table
   $Field:=Field(->[Titles]Label)  `Number of field whose content will be retrieved
   PV FIELD TO CELLS  (Area;1;$Column+1;$Row;0;$Primary;$Table;$Field)

See Also

PV ARRAY TO CELLS, PV FIELDS LIST TO CELLS, PV SET CELL FIELD.