send data to excel with some condition from xbrowse

Post Reply
artu01
Posts: 306
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

send data to excel with some condition from xbrowse

Post by artu01 »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: send data to excel with some condition from xbrowse

Post by nageswaragunupudi »

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: Select all

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: Select all

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
artu01
Posts: 306
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: send data to excel with some condition from xbrowse

Post by artu01 »

nageswaragunupudi wrote:
To see how the second method works, first test this small sample

Code: Select all

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
Post Reply