Command PV SET CELL NAME

4D View

PV SET CELL NAME

version 2004.1 (Modified)


PV SET CELL NAME (area; column; row; name{; mode})

ParameterTypeDescription
areaLongint4D View area
columnLongintCell column number
rowLongintCell row number
nameStringCell name
modeLongint0 or omitted = Add the name, 1 = Replace the name

Description

The PV SET CELL NAME command sets the name of a cell defined using the column and row parameters.

You can access a cell either by its absolute reference — column and row numbers — or its name. The 4D View area formulas can also refer to this cell using its name.

Notes:

• The first three characters of a cell name must not be numbers.

• The cell name must not contain spaces (any spaces contained in the name parameter will be truncated by the command).

The optional mode parameter is used to set the way the new cell name must be set if the cell already has one or more name(s). You can use the constants of the PV Cell properties theme:

• If mode is omitted or if you pass the pv add name constant (value 0), the new name is added to any names already set for the cell.

• If you pass pv replace name (value 1) in mode, the new name replaces any names that have already been set for the cell.

To delete all the names associated with a cell, pass an empty string ("") in name and pv replace name in mode.

Example

This example allows changing the name of the current cell. If it has already a name, the user can replace it:

   C_TEXT($CellName)  `Name to assign to cell
   C_LONGINT($Column)  `Column number of current cell
   C_LONGINT($Row)  `Row number of current cell

   PV GET CURRENT CELL (Area;$Column;$Row)  `Get current cell coordinates
   $CellName:=PV Get cell name (Area;$Column;$Row)  `Name possibly given already

   If ($CellName="")  `The cell already has a name?
      $CellName:=Request("What name do you want to assign to this cell?";"New name")
      If ($CellName#"")  `A name was entered
         PV SET CELL NAME (Area;$Column;$Row;$CellName)  `Assign entered name
      End if
   Else  `Current cell already has a name
      CONFIRM("This cell is already named "+$CellName+". Do you want to rename it?";"Yes";"No") 
      If (OK=1) `The user wants to rename the cell
         PV SET CELL NAME (Area;$Column;$Row;$CellName;pv replace name) 
      End if
   End if

See Also

PV Get cell name, PV GET CELL NAME LIST.