xBrowse numeric formats ( To: G.N.Rao )

xBrowse numeric formats ( To: G.N.Rao )

Postby ORibeiro » Mon Oct 20, 2014 11:44 am

Linares,

Is there any parameter to reset all the numeric formats xBrowse for Brazilian (999,999.99) standard?

If so this parameter also changes the format of the exported to Excel numbers?
Last edited by ORibeiro on Sat Nov 01, 2014 9:54 am, edited 1 time in total.
Oscar Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: xBrowse numeric formats

Postby nageswaragunupudi » Tue Oct 21, 2014 9:43 am

XBrowse (and FWH in general) support 3 kinds of numeric formats, which can be automatically reset during execution, if we do not hard-code numeric formats in our xbrowse program.

A. American format used by most countries "999,999,999.99"
E. European format "999.999.999,99", widely used in Europe
I. Indian forat: "99,99,999.99" used in Indian sub-continent.

To set / change the format, call the function:
FWNumFormat( cInternational, ; // 'A' or 'E' .or. 'I"
lUseThousandSep )

It is desirable to set the format at the beginning of the program
Example:
FWNumFormat( 'A', .t. )

XBrowse automatically builds picture clause of Numeric data on the basis of this specification, appropriate the Field Length and Field Decimals, if "we do not" provide hard-coded formats.
Regards

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

Re: xBrowse numeric formats

Postby ORibeiro » Tue Oct 21, 2014 5:17 pm

Thanks Rao,

I used FwNumFormat ('E',. T.) and, in fact, the numbers in xBrowse already were properly disposed.

However, when exporting to Excel does not recognize the formatting.

Example: Number [12,1234] (two integers and four decimal) exported [121.234,0000] (six integers and four decimal) to excel.
Oscar Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: xBrowse numeric formats

Postby ORibeiro » Mon Oct 27, 2014 9:43 am

No one is having this same problem when exporting numbers in European format to Excel?

Please, see this example:

Code: Select all  Expand view

#include 'fivewin.ch'
#include 'xbrowse.ch'

function Main()
   local oWnd, oBar, oBrw, nTotal:=0
   /*
   A. American format: "999,999,999.99"
   E. European format: "999.999.999,99"
   I. Indian   format: "99,99,999.99"
   */

   FwNumFormat( 'E', .T. )  // European Format
   DBCREATE("TESTXLS",{{"DESC   ","C",010,000},;
                       {"VAL1   ","N",010,001},;
                       {"VAL2   ","N",010,002},;
                       {"VAL3   ","N",010,003},;
                       {"VAL4   ","N",010,004},;
                       {"VAL5   ","N",010,005}})

   USE TESTXLS NEW ALIAS TESTXLS
   FOR nTotal=1 To 20
      APPEND BLANK
      REPL DESC WITH "Linha "+STRZERO(nTotal,2)
      REPL VAL1 WITH 99999 * nTotal / 777
      REPL VAL2 WITH 99999 * nTotal / 777
      REPL VAL3 WITH 99999 * nTotal / 777
      REPL VAL4 WITH 99999 * nTotal / 777
      REPL VAL5 WITH 99999 * nTotal / 777
   NEXT

   DEFINE WINDOW ownd

   DEFINE BUTTONBAR oBar OF oWnd SIZE 80,32 2007

   DEFINE BUTTON OF oBar PROMPT 'Excel' ;
          ACTION MsgMeter( { |oMeter, oText, oDlg, lEnd | ;
          Export2Excel( oBrw, oMeter, oText, oDlg, @lEnd ) } )

   DEFINE BUTTON OF oBar PROMPT 'Quit'  ACTION WndMain():End()

   SET MESSAGE OF oWnd TO '' 2007

   @ 0,0 XBROWSE oBrw OF oWnd ALIAS 'TESTXLS' AUTOCOLS CELL LINES

   // Realmente nao funciona quando exporto para o Broffice/Excel
   oBrw:aCols[2]:bFooter = {|| TRANSFORM(Field->VAL1, "@E 9.999.999,99") }
   oBrw:aCols[3]:bFooter = {|| TRANSFORM(Field->VAL2, "@E 9.999.999,99") }
   oBrw:aCols[4]:bFooter = {|| TRANSFORM(Field->VAL3, "@E 9.999.999,99") }
   oBrw:aCols[5]:bFooter = {|| TRANSFORM(Field->VAL4, "@E 9.999.999,99") }
   oBrw:aCols[6]:bFooter = {|| TRANSFORM(Field->VAL5, "@E 9.999.999,99") }

   oBrw:MakeTotals()
   oBrw:refresh()

   oBrw:CreateFromCode()

   oWnd:oClient      := oBrw

   ACTIVATE WINDOW oWnd MAXIMIZED

   CLOSE DATA

return nil

static function Export2Excel( oBrw, oMeter, oText, oDlg, lEnd )
   oBrw:ToExcel( { |n,t| oMeter:nTotal := t, ;
                         oMeter:Set( n ), ;
                         oText:SetText( Str(n) + '/' + Str(t) ), ;
                         oDlg:Update(), .t. } )
return nil


 
Oscar Ribeiro
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
User avatar
ORibeiro
 
Posts: 187
Joined: Mon Oct 20, 2008 6:33 pm
Location: Itu, Sao Paulo, Brazil

Re: xBrowse numeric formats

Postby karinha » Tue Oct 28, 2014 6:18 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7208
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 11 guests