4D v13

PV Add format

Home

 
4D View v13
PV Add format

PV Add format 


 

PV Add format ( area ; string ) -> Function result 
Parameter Type   Description
area  Longint in 4D View area
string  String in Format string
Function result  Longint in Format ID

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)&nbsp//Format numbers array
 ARRAY STRING(255;$FormatStringArray;0)&nbsp//Format strings array
 C_INTEGER($Position)&nbsp//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 IN ARRAY($FormatStringArray;$Position//Resize...
    INSERT IN ARRAY($FormatNumArray;$Position//...arrays
    $FormatStringArray{$Position}:=$NewFormat  //Assign new format
    $FormatNumArray{$Position}:=PV Add format(Area;$NewFormat//Assign number
 End if

 
PROPERTIES 

Product: 4D
Theme: PV Style
Number: 15884

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D View 6.8

 
SEE ALSO 

PV GET FORMAT LIST
PV REMOVE FORMAT