fwnumFormat ( where is the documentation ?)

Post Reply
User avatar
Silvio.Falconi
Posts: 7170
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 5 times

fwnumFormat ( where is the documentation ?)

Post by Silvio.Falconi »

? FWNumFormat(nPrice,"E") give me an array

is there a function to set number od price in Italian language

instead of transform(nPrice,"@E €999,999.99")
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
Posts: 7170
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 5 times

Re: fwnumFormat ( where is the documentation ?)

Post by Silvio.Falconi »

this afternoon I made this (usefull for us Italian people)

sample :
nPrice := 2545.66
Euro(nprice, 10, 2, )

nprice can be numeric or string

Code: Select all | Expand

Function Euro(nValore, nLen, nDec, lVirgola)
  local n, cEuro

  default nLen := 0, ;
          nDec := 2, ;
          lVirgola:= .T.

  if valtype(nValore) == "C"
    n := val(nValore)
  else
    n := nValore
  endif
                     
  if lVirgola
    cEuro := transform(n, "@E 999,999,999,999" + ; //R
                        iif(nDec > 0, "." + replicate("9", nDec), ""))
  else
    cEuro := str(n, max(nLen, 15), nDec)
  endif

  cEuro := ltrim(cEuro)

  if nLen > 0
    n := nLen - 1
    if len(cEuro) > n
      cEuro := replicate("*", n)
    else
      cEuro := padl(cEuro, n)
    endif
  endif

Return("€" + cEuro)
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

Re: fwnumFormat ( where is the documentation ?)

Post by nageswaragunupudi »

This is not necessary.
You can do this using FWNumFormat() and NUMPICT( nLen, nDec, ... )

Code: Select all | Expand

function temptest()

   local cPic1, cPic2
   local nVal := 1234567.89

   FWNumFormat( "E", .t. )

   cPic1 := NUMPICT( 10, 2 )
   cPic2 := NUMPICT( 10, 2, nil, nil, nil, .t. )

   XBROWSER { { cPic1, nVal, cPic2, nVal } } TITLE "EUROPEN" SETUP ( ;
      oBrw:cEditPictures := { nil, cPic1, nil, cPic2 }, ;
      oBrw:cHeaders := { "PIC1", "VAL1", "PIC2", "VAL2" } )


   FWNumFormat( "B", .t. )

   cPic1 := NUMPICT( 10, 2 )
   cPic2 := NUMPICT( 10, 2, nil, nil, nil, .t. )

   XBROWSER { { cPic1, nVal, cPic2, nVal } } TITLE "BRITISH" SETUP ( ;
      oBrw:cEditPictures := { nil, cPic1, nil, cPic2 }, ;
      oBrw:cHeaders := { "PIC1", "VAL1", "PIC2", "VAL2" } )

   FWNumFormat( "A", .t. )

   cPic1 := NUMPICT( 10, 2 )
   cPic2 := NUMPICT( 10, 2, nil, nil, nil, .t. )

   XBROWSER { { cPic1, nVal, cPic2, nVal } } TITLE "AMERICAN" SETUP ( ;
      oBrw:cEditPictures := { nil, cPic1, nil, cPic2 }, ;
      oBrw:cHeaders := { "PIC1", "VAL1", "PIC2", "VAL2" } )

   FWNumFormat( "I", .t. )

   cPic1 := NUMPICT( 10, 2 )
   cPic2 := NUMPICT( 10, 2, nil, nil, nil, .t. )

   XBROWSER { { cPic1, nVal, cPic2, nVal } } TITLE "INDIAN" SETUP ( ;
      oBrw:cEditPictures := { nil, cPic1, nil, cPic2 }, ;
      oBrw:cHeaders := { "PIC1", "VAL1", "PIC2", "VAL2" } )

   FWNumFormat( "A", .t., nil, HB_UTF8CHR( 0x20b1 ) )

   cPic1 := NUMPICT( 10, 2 )
   cPic2 := NUMPICT( 10, 2, nil, nil, nil, .t. )

   XBROWSER { { cPic1, nVal, cPic2, nVal } } TITLE "PHILIPPINES" SETUP ( ;
      oBrw:cEditPictures := { nil, cPic1, nil, cPic2 }, ;
      oBrw:cHeaders := { "PIC1", "VAL1", "PIC2", "VAL2" } )

   FWNumFormat( "A", .t., nil, HB_UTF8CHR( 0x0E3F ) )

   cPic1 := NUMPICT( 10, 2 )
   cPic2 := NUMPICT( 10, 2, nil, nil, nil, .t. )

   XBROWSER { { cPic1, nVal, cPic2, nVal } } TITLE "THAILAND" SETUP ( ;
      oBrw:cEditPictures := { nil, cPic1, nil, cPic2 }, ;
      oBrw:cHeaders := { "PIC1", "VAL1", "PIC2", "VAL2" } )

return nil
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

Re: fwnumFormat ( where is the documentation ?)

Post by nageswaragunupudi »

XBrowse, TDatarow etc programs automatically use FWNumFormt() settings to format numeric values.
By simply changing the settings of FWNumFormat() you can Internationalize your application as long as you do not interfere with their working by providing your own hard coded picture formats.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio.Falconi
Posts: 7170
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 5 times

Re: fwnumFormat ( where is the documentation ?)

Post by Silvio.Falconi »

Sorry, on that situation I must not use the numlet on a xbrowse but on anoter control
see please viewtopic.php?f=3&t=38670
the price is printed on each rows
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

Re: fwnumFormat ( where is the documentation ?)

Post by nageswaragunupudi »

TRANSFORM( nValue, NUMPICT( nLen, nDec, nil, nil, nil, .t. ) )
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio.Falconi
Posts: 7170
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 5 times

Re: fwnumFormat ( where is the documentation ?)

Post by Silvio.Falconi »

thanks run ok as you can see

Image

I set 7 nlen 2 ndec
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Jorge_T
Posts: 38
Joined: Tue Jan 22, 2019 8:28 am

Re: fwnumFormat ( where is the documentation ?)

Post by Jorge_T »

nageswaragunupudi wrote:XBrowse, TDatarow etc programs automatically use FWNumFormt() settings to format numeric values.
By simply changing the settings of FWNumFormat() you can Internationalize your application as long as you do not interfere with their working by providing your own hard coded picture formats.


Hi Mr. Nages,
With Xbrowse I try to export to Calc format from LibreOffice or Xls from Excel with the instructions Obrw: ToCalc () or Obrw: ToExcel (). I use xbrNumFormat( "E", .t. ) but depends on the number of decimals of the fields it gives me the error "could not set format #, ## 0.00000 to Column N" and in the exported sheet it does not separate well the numerical formats. Also sometimes appears the error (DOS Error -2147352567) WINOLE / 1006
I would appreciate if you can show me some example of the proper functioning of this instruction, thank you very much and regards
viewtopic.php?f=6&t=38661#p230577
Jorge
--------------------------------------------------
Fivewin 18.10 - Harbour - BCC 7 - PellesC
--------------------------------------------------
Post Reply