Hola amigos, pues eso.
Tengo un xbrowse con array (centenares de documentos), el cual necesito filtrar por un documento, segun su numero.
Pueden suministrar un pequeño ejemplo?
Gracias-
Como filtrar un Xbrowse con Array?
- FranciscoA
- Posts: 2164
- Joined: Fri Jul 18, 2008 1:24 am
- Location: Chinandega, Nicaragua, C.A.
- nageswaragunupudi
- Posts: 10733
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 11 times
- Contact:
Re: Como filtrar un Xbrowse con Array?
If you use recent versions, xbrowse provides incremental filters on array browse too
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- FranciscoA
- Posts: 2164
- Joined: Fri Jul 18, 2008 1:24 am
- Location: Chinandega, Nicaragua, C.A.
Re: Como filtrar un Xbrowse con Array?
Thanks, Mr. Nages.
I will take a look to my xbrowse.
Regards
I will take a look to my xbrowse.
Regards
Francisco J. Alegría P.
Chinandega, Nicaragua.
Fwxh-MySql-TMySql
Chinandega, Nicaragua.
Fwxh-MySql-TMySql
- nageswaragunupudi
- Posts: 10733
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 11 times
- Contact:
Re: Como filtrar un Xbrowse con Array?
Code: Select all | Expand
#include "fivewin.ch"
#include "xbrowse.ch"
function Main()
local aData[ 20000 ]
local aSub
local oDlg, oFont, oBrw, n, r
local bFilter := { |x| x[ 1 ] % 3 == 0 } // can be any other filter cond
// Initialize Array
for n := 1 to 20000
aData[ n ] := { HB_RandomInt( 10001, 99999 ) }
next
//
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 300,600 PIXEL FONT oFont
@ 10,10 XBROWSE oBrw SIZE -10,-30 PIXEL OF oDlg DATASOURCE aData ;
COLUMNS 1,1 HEADERS "SlNo", "Data" ;
PICTURES "99999", "999,999" ;
CELL LINES NOBORDER FOOTERS
oBrw:aCols[ 1 ]:bEditValue := { || oBrw:nArrayAt }
oBrw:aCols[ 1 ]:bFooter := { || oBrw:nLen }
oBrw:CreateFromCode()
@ 275, 10 BUTTON "SetFilter" SIZE 40,12 PIXEL OF oDlg ACTION ;
( If( aSub == nil, ( aSub := {}, AScan( aData, { |x| If ( Eval( bFilter, x ), AAdd( aSub, x ), nil ) } ) ), nil ), ;
n := oBrw:aRow, r := oBrw:nRowSel, oBrw:aArrayData := aSub, oBrw:Refresh( .t. ), ;
oBrw:nArrayAt := Max( 1, AScan( aSub, { |x| x == n } ) ), ;
oBrw:nRowSel := r, ;
oBrw:SetFocus() )
@ 275, 55 BUTTON "ClearFilter" SIZE 40,12 PIXEL OF oDlg ACTION ;
( n := oBrw:aRow, r := oBrw:nRowSel, oBrw:aArrayData := aData, oBrw:Refresh( .t. ), ;
oBrw:nArrayat := Max( 1, AScan( aData, { |x| x == n } ) ), ;
oBrw:nRowSel := r, ;
oBrw:SetFocus() )
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Como filtrar un Xbrowse con Array?
Thanks, Mr. Nages!
And how it would be with arrays in the lines?
TIA & Regards
Euclides
And how it would be with arrays in the lines?
TIA & Regards
Euclides
- FranciscoA
- Posts: 2164
- Joined: Fri Jul 18, 2008 1:24 am
- Location: Chinandega, Nicaragua, C.A.
Re: Como filtrar un Xbrowse con Array?
Excellent example, Mr. Rao. I'll work on it .
Thank you for your magnificent support.
Greetings .
Thank you for your magnificent support.
Greetings .
Francisco J. Alegría P.
Chinandega, Nicaragua.
Fwxh-MySql-TMySql
Chinandega, Nicaragua.
Fwxh-MySql-TMySql
- FranciscoA
- Posts: 2164
- Joined: Fri Jul 18, 2008 1:24 am
- Location: Chinandega, Nicaragua, C.A.
Re: Como filtrar un Xbrowse con Array?
Thank you so much , Mr. Rao.
Based on your example could solve my problem.
Best regards.
Based on your example could solve my problem.
Best regards.
Francisco J. Alegría P.
Chinandega, Nicaragua.
Fwxh-MySql-TMySql
Chinandega, Nicaragua.
Fwxh-MySql-TMySql