PV Add format
version 6.8
PV Add format (area; string) Longint
Parameter | Type | Description | |
area | Longint | 4D View area | |
string | String | Format string |
Function result Longint Format 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 IN ARRAY($FormatStringArray;$Position) `Resize...
INSERT IN ARRAY($FormatNumArray;$Position) `...arrays
$FormatStringArray{$Position}:=$NewFormat `Assign new format
$FormatNumArray{$Position}:=PV Add format (Zone;$NewFormat) `Assign number
End if
See Also