FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour fwnumFormat ( where is the documentation ?)
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
fwnumFormat ( where is the documentation ?)
Posted: Mon Mar 23, 2020 03:40 PM

? 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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: fwnumFormat ( where is the documentation ?)
Posted: Mon Mar 23, 2020 04:07 PM
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 (fw): Select all Collapse
 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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: fwnumFormat ( where is the documentation ?)
Posted: Tue Mar 24, 2020 06:02 AM
This is not necessary.
You can do this using FWNumFormat() and NUMPICT( nLen, nDec, ... )

Code (fw): Select all Collapse
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


Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: fwnumFormat ( where is the documentation ?)
Posted: Tue Mar 24, 2020 06:07 AM

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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: fwnumFormat ( where is the documentation ?)
Posted: Tue Mar 24, 2020 11:09 AM

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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: fwnumFormat ( where is the documentation ?)
Posted: Tue Mar 24, 2020 02:38 PM

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

Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: fwnumFormat ( where is the documentation ?)
Posted: Tue Mar 24, 2020 06:18 PM
thanks run ok as you can see



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
Posts: 38
Joined: Tue Jan 22, 2019 08:28 AM
Re: fwnumFormat ( where is the documentation ?)
Posted: Wed Mar 25, 2020 08:08 AM
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

--------------------------------------------------

Continue the discussion