FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TXBrowse and Filters
Posts: 99
Joined: Wed Nov 02, 2005 10:40 AM
TXBrowse and Filters
Posted: Wed Jan 09, 2008 11:35 AM

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.

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Filter in XBrowse
Posted: Wed Jan 09, 2008 11:53 AM

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

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.
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
TXBrowse and Filters
Posted: Wed Jan 09, 2008 04:18 PM

in xHarbour you can use dbfScope functions even with dbfntx rdd.
No need to change to another rdd.

Regards,
Detlef

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
TXBrowse and Filters
Posted: Wed Jan 09, 2008 04:35 PM

ASK,

Why would you not want to use scopes? That is what they are for.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 682
Joined: Tue Feb 14, 2006 09:48 AM
TXBrowse and Filters
Posted: Wed Jan 09, 2008 05:14 PM
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.

...
   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 )
Saludos desde Mallorca
Biel Maimó
http://bielsys.blogspot.com/
Posts: 99
Joined: Wed Nov 02, 2005 10:40 AM
TXBrowse and Filters
Posted: Thu Jan 10, 2008 08:42 AM

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

Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
TXBrowse and Filters
Posted: Thu Jan 10, 2008 08:53 AM

Ask,

if you are using cdx, you can also try to replace the standard dbfcdx-rdd with bmdbfcdx that comes with xharbour. It´s working with bitmaps filters and it seems to be faster than the original cdx. You don´t need to change any sourcecode, just link in the lib.

kind regards

Stefan
Posts: 99
Joined: Wed Nov 02, 2005 10:40 AM
TXBrowse and Filters
Posted: Thu Jan 10, 2008 09:04 AM

Stefan,

I'm using ntx , but thank you anyway.

regards,

A.S.K

Continue the discussion