fwnumFormat ( where is the documentation ?)

fwnumFormat ( where is the documentation ?)

Postby Silvio.Falconi » Mon Mar 23, 2020 3: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 November 2023 - January 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: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: fwnumFormat ( where is the documentation ?)

Postby Silvio.Falconi » Mon Mar 23, 2020 4: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: Select all  Expand view  RUN
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 November 2023 - January 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: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: fwnumFormat ( where is the documentation ?)

Postby nageswaragunupudi » Tue Mar 24, 2020 6:02 am

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

Code: Select all  Expand view  RUN
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: 10659
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: fwnumFormat ( where is the documentation ?)

Postby nageswaragunupudi » Tue Mar 24, 2020 6: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
User avatar
nageswaragunupudi
 
Posts: 10659
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: fwnumFormat ( where is the documentation ?)

Postby Silvio.Falconi » 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 November 2023 - January 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: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: fwnumFormat ( where is the documentation ?)

Postby nageswaragunupudi » Tue Mar 24, 2020 2:38 pm

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10659
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: fwnumFormat ( where is the documentation ?)

Postby Silvio.Falconi » Tue Mar 24, 2020 6:18 pm

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 November 2023 - January 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: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: fwnumFormat ( where is the documentation ?)

Postby Jorge_T » Wed Mar 25, 2020 8: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
--------------------------------------------------
Jorge_T
 
Posts: 38
Joined: Tue Jan 22, 2019 8:28 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 50 guests