send data to excel with some condition from xbrowse

send data to excel with some condition from xbrowse

Postby artu01 » Wed Jul 22, 2020 7: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
artu01
 
Posts: 400
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: send data to excel with some condition from xbrowse

Postby nageswaragunupudi » Thu Jul 23, 2020 3: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: Select all  Expand view  RUN

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  Expand view  RUN

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

Re: send data to excel with some condition from xbrowse

Postby artu01 » Thu Jul 23, 2020 10:11 pm

nageswaragunupudi wrote:
To see how the second method works, first test this small sample
Code: Select all  Expand view  RUN

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 73 guests