Page 1 of 1
send data to excel with some condition from xbrowse
Posted: Wed Jul 22, 2020 7:43 pm
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
Re: send data to excel with some condition from xbrowse
Posted: Thu Jul 23, 2020 3:06 am
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 := {} } )
Re: send data to excel with some condition from xbrowse
Posted: Thu Jul 23, 2020 10:11 pm
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