FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour send data to excel with some condition from xbrowse
Posts: 400
Joined: Fri May 11, 2007 08:20 PM
send data to excel with some condition from xbrowse
Posted: Wed Jul 22, 2020 07:43 PM

Guys:
With xbrowse I want send data to excel using :toExcel but only those registers that meet some condition
and not all data that is displayed in the xbrowse

is it posible?, could you give me an example, please

Thank you

fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: send data to excel with some condition from xbrowse
Posted: Thu Jul 23, 2020 03:06 AM
This is not provided as a part of ToExcel() method.

However, there are two ways of doing it.

Approach-1

a) SetFilter to the condition. oBrw:Refresh()
b) ToExcel()
c) Clear filter and oBrw:Refresh()

Approach-2

a) Prepare an array of RecNo()s to be exported.
Example:
Code (fw): Select all Collapse
aRecNo := {}
( oBrw:cAlias )->( DBEVAL( { || AAdd( aRecNo, RECNO() ) }, { || your condtion } ) )


b) Assign oBrw:aSelected := aRecNo
c) oBrw:ToExcel()
d) Clear oBrw:aSelected := {}

To see how the second method works, first test this small sample
Code (fw): Select all Collapse
XBROWSER "STATES.DBF" SETUP ( oBrw:bRClicked := { |r,c,f,o| ;
   o:aselected := { 2,3,4 }, o:ToExcel(), o:aselected := {} } )
Regards



G. N. Rao.

Hyderabad, India
Posts: 400
Joined: Fri May 11, 2007 08:20 PM
Re: send data to excel with some condition from xbrowse
Posted: Thu Jul 23, 2020 10:11 PM
nageswaragunupudi wrote:

To see how the second method works, first test this small sample
Code (fw): Select all Collapse
XBROWSER "STATES.DBF" SETUP ( oBrw:bRClicked := { |r,c,f,o| ;
   o:aselected := { 2,3,4 }, o:ToExcel(), o:aselected := {} } )


thank mr. rao,
I use recordset, so how could be the sentence?

thanks in advance
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql

Continue the discussion