Happy new year to all.
How can i modify bskip , bgotop,bgobottom etc. and make my TXBrowse show only the record i want to see?
e.g.
Code Descr
1 ASK
2 Fivetech
3 Software
4 Test
how can i show code>=2 .and. code<=3 ? I DON'T WANT TO USE Setfilter or Ordscope commands.
Thank in advance
A.S.K.
TXBrowse and Filters
Filter in XBrowse
The best way is, to convert ( if you still using NTX )
to CDX ( Foxpro ).
There is a SCOPE-call ( filter ) for the Index.
That means, when you change the record-position in your
browser, you see only the records, you defined in the SCOPE.
In my sample-collection for xBrowse ( in a few days )
you can see, how it works.
U. König
to CDX ( Foxpro ).
There is a SCOPE-call ( filter ) for the Index.
That means, when you change the record-position in your
browser, you see only the records, you defined in the SCOPE.
In my sample-collection for xBrowse ( in a few days )
you can see, how it works.
U. König
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- Detlef Hoefner
- Posts: 312
- Joined: Sat Oct 08, 2005 9:12 am
- Location: Germany
- Contact:
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
- Biel EA6DD
- Posts: 680
- Joined: Tue Feb 14, 2006 9:48 am
- Location: Mallorca
- Contact:
Like other have suggested, I thing the best and easy solution is using scopes.
If you still don't want to use scope, can do it this way.
If you still don't want to use scope, can do it this way.
Code: Select all
...
oBrw:bGoTop := { || TopFil( cAlias, cClave ) }
oBrw:bGoBottom := { || Botfil( cAlias, cClave ) }
oBrw:bSkip := { | n | SkipFil( cAlias, cClave, n ) }
...
//---------------------------------
FUNCTION SkipFil( cAlias, cKey, nReg )
//---------------------------------
LOCAL nNext := 0
DEFAULT nReg := 1
IF nReg = 0 .OR. ( cAlias ) ->( LastRec() ) = 0 .OR. ! ( &( ( cAlias ) ->( IndexKey( 0 ) ) ) = cKey )
( cAlias ) ->( DBSkip( 0 ) )
ELSEIF nReg > 0 .AND. ( cAlias ) ->( RecNo() ) <> ( cAlias ) ->( LastRec() ) + 1
DO WHILE nNext <= nReg .AND. ! ( cAlias ) ->( Eof() ) .AND. &( ( cAlias ) ->( IndexKey( 0 ) ) ) = cKey
( cAlias ) ->( DBSkip() )
nNext ++
ENDDO
( cAlias ) ->( DBSkip( - 1 ) )
nNext --
ELSEIF nReg < 0
DO WHILE nNext >= nReg .AND. ! Bof() .AND. &( ( cAlias ) ->( IndexKey( 0 ) ) ) = cKey
( cAlias ) ->( DBSkip( - 1 ) )
nNext --
ENDDO
IF ! Bof()
( cAlias ) ->( DBSkip() )
ENDIF
nNext ++
ENDIF
RETURN ( nNext )
//--------------------------
FUNCTION TopFil( cAlias, cKey )
//--------------------------
( cAlias ) ->( DBSeek( cKey, .T. ) )
RETURN NIL
//--------------------------
FUNCTION BotFil( cAlias, cKey )
//--------------------------
( cAlias ) ->( DBSeek( Ultima( cKey ), .T. ) )
( cAlias ) ->( DBSkip( - 1 ) )
RETURN NIL
//-----------------------
FUNCTION Ultima( xValue )
//-----------------------
LOCAL cType := ValType( xValue ), xNext
DO CASE
CASE ( cType == "C" )
xValue := Stuff( xValue, Len( xValue ), 1, ;
Chr( Asc( Right( xValue, 1 ) ) + 1 ) )
CASE ( cType == "N" )
xValue ++
CASE ( cType == "D" )
xValue ++
ENDCASE
xNext := xValue
RETURN( xNext )
ukoenig , Detlef , James , Biel
Thank you all for your reply .The reason that i don't want to use scopes is that i have already allot of source code written with conditions (filters etc) and i want to change my xbrowse to use this conditions and not to change my whole program and start using scopes. As i can see set filter command is very slow. I guess I will try "Biel EA6DD" solution.
Thank you all
A.S.K
Thank you all for your reply .The reason that i don't want to use scopes is that i have already allot of source code written with conditions (filters etc) and i want to change my xbrowse to use this conditions and not to change my whole program and start using scopes. As i can see set filter command is very slow. I guess I will try "Biel EA6DD" solution.
Thank you all
A.S.K
-
- Posts: 824
- Joined: Thu Oct 13, 2005 7:39 am
- Location: Germany