fwnumFormat ( where is the documentation ?)

Post Reply
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

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")
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

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

 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)
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
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

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: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
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: 4956
Joined: Thu Oct 18, 2012 7:17 pm

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 http://forums.fivetechsupport.com/viewt ... =3&t=38670
the price is printed on each rows
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
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: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: fwnumFormat ( where is the documentation ?)

Post by Silvio.Falconi »

thanks run ok as you can see

Image

I set 7 nlen 2 ndec
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Jorge_T
Posts: 36
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
https://forums.fivetechsupport.com/view ... 61#p230577
Jorge
--------------------------------------------------
Fivewin 18.10 - Harbour - BCC 7 - PellesC
--------------------------------------------------
Post Reply