Page 1 of 1

Search record from tab

PostPosted: Tue Sep 15, 2015 9:12 am
by Silvio.Falconi
i Have a tabs on the bottom of a xbrowse
I use customer.dbf of fwh samples

Image

How I can make to search on xbrowse the customer with initial letter sample " A" when I click on tab ?

the first tab "tutti" as "All show"

thanks in advance

Re: Search record from tab

PostPosted: Wed Sep 16, 2015 7:09 am
by nageswaragunupudi
When a tab is pressed:
Action ( oBrw:Seek( "A" ) )
or oBrw:Seek( "B" )
for Tuti oBrw:Seek( "" )

Re: Search record from tab

PostPosted: Wed Sep 16, 2015 7:51 am
by Silvio.Falconi
Sorry Mr rao ,
I made

@ oApp():oDlg:nGridBottom, nSplit+2 TABS oApp():oTab ;
OPTION nOrder SIZE oApp():oWndMain:nWidth()-80, 12 PIXEL OF oApp():oDlg ;
ITEMS "Tutti","A","B","C","D","E","F","G","H","I","J","K","L","M","N","Ñ","O","P","Q","R","S","T","U","V","W","X","Y","Z" ;
ACTION ( CU->(DbSetOrder(1)),;
CU->(DbGoTop()) ,;
IIF( oApp():oTab:nOption=1, oApp():oGrid:Seek(""),;
oApp():oGrid:Seek(alltrim(oApp():oTab:aPrompts[oApp():oTab:nOption] )) ),;
oApp():oGrid:Refresh(.t.) )


it run ok bu tI mean to show
sample only that customer init for "A" or "B" ...
I hope you understand me

I tried with
CU->(DbSetFilter( alltrim(Left(CU->First,1))==alltrim(oApp():oTab:aPrompts[oApp():oTab:nOption] ) )),;
oApp():oGrid:refresh(),;

but it not run

Re: Search record from tab

PostPosted: Thu Sep 17, 2015 7:51 am
by Silvio.Falconi
I tried :

@ oApp():oDlg:nGridBottom, nSplit+2 TABS oApp():oTab ;
OPTION nOrder SIZE oApp():oWndMain:nWidth()-80, 12 PIXEL OF oApp():oDlg ;
ITEMS "Tutti","A","B","C","D","E","F","G","H","I","J","K","L","M","N","Ñ","O","P","Q","R","S","T","U","V","W","X","Y","Z" ;
ACTION ( CU->(DbSetOrder(nOrder)),;
Cufiltrar(oApp():oGrid, oApp():oTab,oApp():oTab:nOption) )



Function Cufiltrar (oGrid,oTab,n,nOrder)

?alltrim(oApp():oTab:aPrompts[n] )
do case
case nOrder= 1
CU->(DbSetFilter( alltrim(Left(CU->First,1))==alltrim(oApp():oTab:aPrompts[n] ) ))

case nOrder= 2
CU->(DbSetFilter( alltrim(Left(CU->Last,1))==alltrim(oApp():oTab:aPrompts[n] ) ))

endcase
CU->(DbGoTop())
oApp():oGrid:Refresh(.t.)
return nil


but it not run

If I use Wdbu and make a filter sample Left(cu->first,1)="A" it run
why on fwh not run ?

Re: Search record from tab

PostPosted: Thu Sep 17, 2015 8:10 am
by Silvio.Falconi
Mr Rao
I made

@ oApp():oDlg:nGridBottom, nSplit+2 TABS oApp():oTab ;
OPTION nOrder SIZE oApp():oWndMain:nWidth()-80, 12 PIXEL OF oApp():oDlg ;
ITEMS "Tutti","A","B","C","D","E","F","G","H","I","J","K","L","M","N","Ñ","O","P","Q","R","S","T","U","V","W","X","Y","Z" ;
ACTION CuFiltrar(oApp:oGrid,oApp:oTab,oApp():oTab:nOption,nOrder)


Function CuFiltrar(oGrid,oTab,n,nOrder)

if n=1
CU->(DbClearFilter())
CU->(DbGoTop())
oApp():oGrid:Refresh(.t.)
return nil
endif

do case
case nOrder= 1
set filter to left(CU->FIRST,1)=oApp():oTab:aPrompts[n]
case nOrder= 2
set filter to left(CU->LAST,1)=oApp():oTab:aPrompts[n]
endcase
CU->(DbGoTop())
oApp():oGrid:Refresh(.t.)
return nil



It run ok now but perhaps there is a method ( with codeblocks) to show the same ?

Re: Search record from tab

PostPosted: Thu Sep 17, 2015 2:51 pm
by James Bott

Re: Search record from tab

PostPosted: Fri Sep 18, 2015 7:14 am
by Silvio.Falconi
James,
Nw with Setfilter run ok
only I ask if there is a method more good
ordscope I never use or perhaps I not remember
but I not found a test sample with ordscope to try

Re: Search record from tab

PostPosted: Fri Sep 18, 2015 9:16 am
by ukoenig
Silvio,

a sample :

from ORD.CH :

#define TOPSCOPE 0
#define BOTTOMSCOPE 1

set order to tag dates
// set range
dates->(ordScope(0, dtos(Start) )) // set top scope
dates->(ordScope(1, dtos(End) )) // set bottom scope
dates->(dbgotop())
dates->(ordScope(0, NIL )) // set top to NIL
dates->(ordScope(1, NIL )) // set bottom to NIL


best regards
Uwe :D

Re: Search record from tab

PostPosted: Fri Sep 18, 2015 2:24 pm
by James Bott
Silvio,

I never use set filter anymore, ordscope is so much faster. You will love it, give it a try.

James