PV Add format

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

version 6.8


PV Add format (area; string) Longint

ParameterTypeDescription
areaLongint4D View area
stringStringFormat string
Function resultLongintFormat ID

Description

The PV Add format command adds the format string to the area and returns its ID.

If string already exists, the PV Add format command returns its ID (this number can also be obtained using the PV GET FORMAT LIST command).

Example

We want to remove the American monetary format available for the active area, but we must make sure that the European monetary format (Euros) is still available.

   C_STRING(255;$OldFormat)  `Format string to remove from Area
   C_STRING(255;$NewFormat)  `Format string to add to Area

   ARRAY LONGINT($FormatNumArray;0)  `Format numbers array
   ARRAY STRING(255;$FormatStringArray;0)  `Format strings array
   C_INTEGER($Position)  `Position of the format to remove in number and name arrays

   $OldFormat:="$###,##0.00"
   $NewFormat:="### ##0,00 EUR"

   PV GET FORMAT LIST (Area;$FormatNumArray;$FormatStringArray)  `List of available formats

   $Position:=Find in array($FormatStringArray;$OldFormat)
   If ($Position#-1)  `Format to remove present in area?
      PV REMOVE FORMAT (Area;$FormatNumArray{$Position})  `Remove it
   End if

      `Format to add unavailable in area?
   If (Find in array($FormatStringArray;$NewFormat)=-1)
      $Position:=Size of array($FormatStringArray)+1  `We will add it
      INSERT ELEMENT($FormatStringArray;$Position)  `Resize...
      INSERT ELEMENT($FormatNumArray;$Position)  `...arrays
      $FormatStringArray{$Position}:=$NewFormat  `Assign new format
      $FormatNumArray{$Position}:=PV Add format (Zone;$NewFormat)  `Assign number
   End if

See Also

PV GET FORMAT LIST, PV REMOVE FORMAT.


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