4D View v16

PV Add format

Home

 
4D View v16
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_TEXT($OldFormat//Format string to remove from Area
 C_TEXT($NewFormat//Format string to add to Area
 
 ARRAY LONGINT($FormatNumArray;0) //Format numbers array
 ARRAY TEXT($FormatStringArray;0) //Format strings array
 C_LONGINT($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 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



See also 

PV GET FORMAT LIST
PV REMOVE FORMAT

 
PROPERTIES 

Product: 4D View
Theme: PV Style
Number: 15884

 
HISTORY 

Created: 4D View 6.8

 
ARTICLE USAGE

4D View Language ( 4D View v16)