Command PV SET CELL FORMULA

4D View

PV SET CELL FORMULA

version 6.8


PV SET CELL FORMULA (area; column; row; formula)

ParameterTypeDescription
areaLongint4D View area
columnLongintCell column number
rowLongintCell row number
formulaStringFormula

Description

The PV SET CELL FORMULA command sets formula in the cell set by column and row.

Example

The following example creates an incrementation to the bottom from a numeric type cell. If the value of the latter is later modified, the incrementation will automatically be updated by formulas that we place in the cells with PV SET CELL FORMULA.

   C_INTEGER($CopyNumber)  `Number of copies to execute
   C_LONGINT($Column;$Row)  `Coordinates of cell to copy
   C_INTEGER($Index)  `Loop index
   C_TEXT($Name)  `Start cell name

   PV GET CURRENT CELL (Area;$Column;$Row)
   If (PV Get cell value type (Area;$Column;$Row)=pv number type value)  `Type verification
         `5 by default
      $CopyNumber:=Num(Request("How many cells to the bottom do you want to increment?";"5"))
      If ($CopyNumber>0)  `Validate
         $Name:=PV Get cell name (Area;$Column;$Row)  `Get name
         If ($Name="")  `No name?
            $Name:="COL"+String($Column)+"RW"+String($Row)  `It currently has one
            PV SET CELL NAME(Area;$Column;$Row;$Name)  `"COL2RW3" type name
         End if 
         For ($Index;$Row+1;$Row+$CopyNumber)  `$CopyNumber loop(s)
               `Increase
            PV SET CELL FORMULA (Area;$Column;$Index;"="+$Name+"+"+String($Index-$Row))
         End for 
      End if 
   Else  `Incorrect type
      ALERT("The start cell must be a numeric type")
   End if 

See Also

PV Get cell formula, PV Get cell value type.