FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse
Posted: Thu Sep 15, 2011 04:32 AM

A note on "SET FILTER TO !DELETED()".

This does not slow down the navigation, if proper care is taken. (Applies to DBFCDX and ADSCDX). On the contrary this will greatly improve the speed in case the DBF contains lots of deleted records.

Important:
Create one tag compulsorily on all medium and large tables on DELETED().'
Example: INDEX ON DELETED() TAG DELETED.

Instead of clearing filter
SET FILTER TO !DELETED()
For setting a filter:
SET FILTER TO <condition> .AND. !DELETED().

Performance will considerably improve on DBFs having many deleted records.

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse
Posted: Thu Sep 15, 2011 04:34 AM
Bayron wrote:Thanks for your answer, I do use basicly the same logic, but as I said before
The problem is not about the Deleted Records, but is that when I delete a record, the color of that row is lost and I get two consecutive rows with the same color....As you can see the above picture...


I think the problem is with the painting, when I use oBrw:Refresh() :bClrStd is not Evaluated and Repainted again...

I am just going to set the browse records on a single color... to avoid all of the trouble...


NOT AT ALL.
I prepared the sample to show you that the alternating colors are painted correctly after deleting records. You see my sample. Works PERFECTLY.
If it is not working for you, please recheck your code.

Note: Hope you are using DBFCDX
Regards



G. N. Rao.

Hyderabad, India
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: xBrowse
Posted: Thu Sep 15, 2011 04:53 AM

That should be my problem... I am not using Indexes...

I'm sorry, for the misunderstanding, I only mentionated it on the first post!!!

I'll try with indexes...

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: xBrowse
Posted: Thu Sep 15, 2011 05:22 AM

Mr. Rao,

I Tested your Sample, and It work's as expected...

I am testing to see how I can apply this to my case, because I am using the browse to add items that do not need sorting, because it's a receipt...

If I use a blank field to index, should the Index leave the order as is????

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse
Posted: Thu Sep 15, 2011 08:39 AM

The sample I give works perfectly whether there is any index or not.
But does not work with DBFNTX.

Now I understand that you must be using DBFNTX. If you use DBFCDX, it works as expected, with or without index/

If for some reason you have to use DBFNTX, please keep in mind that you may not be able to avail certain features like this.

Regards



G. N. Rao.

Hyderabad, India
Posts: 883
Joined: Thu Dec 24, 2009 12:46 AM
Re: xBrowse
Posted: Thu Sep 15, 2011 01:05 PM
Mr. Rao,

Yes, I Confirm it now, It works with and without Indexes as long as the VIA "DBFCDX" is included when openning the database even if no index is created and used...and the other commands are included:

Code (fw): Select all Collapse
REQUEST DBFCDX
....
SET DELETED ON
....
....

SET FILTER TO !DELETED()


Thanks for your patience and concise expanations!!!

It is for your very well explanated answers that we can unsderstand how easy it's to use the very complex right use of the powerfull xbrowse...

=====>

Bayron Landaverry
xBasePHP.com
(215)2226600 Philadelphia,PA, USA
MayaBuilders@gMail.com
Guatemala

FWH25.06--Harbour 3.0.0--BCC7.7--UEstudio 10.10
Windows 10

FiveWin, One line of code and it's done...

Posts: 80
Joined: Tue Mar 25, 2008 09:03 PM
Re: xBrowse
Posted: Thu Sep 15, 2011 08:47 PM
to color lines in a browser, try:
Code (fw): Select all Collapse
    // Setup alternating row flag 
   lClrFlag:=.f. 
   olbx1:bSkip:={| nRecs | ( if(nRecs == nil, nRecs := 1,),nRecs:= arccod->(dbskipper( nRecs )), lClrFlag:= if( nRecs % 2 = 0, lClrFlag,!lClrFlag), nRecs) } 

   // Define alternating row colors 
   olbx1:bClrStd:= {|| if(lClrFlag,{ CLR_BLACK, RGB(196,226,255)},{ CLR_BLACK, RGB(221,245,255) }) }


works both with a set filter to .... and with record delete
I do not remember where I found this code ... perhaps tsbrowse ???

arccod -- name archive

Ciao
Stefano
FWH 14.11 + xHarbour + bcc582
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse
Posted: Thu Sep 15, 2011 11:44 PM

Yes, Mr. Stefano's solution works in all cases.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion