Page 1 of 1

TAGELEMENT in DCBROWSE

Posted: Tue Sep 08, 2015 2:17 am
by Victorio
Hi,

I want implement Tag elements to browse database.
In example TAGGING is present this function, but with array (in array is directory).
I want same with browse database (DCBROWSE...., DCBROWSECOL FIELD....)

In database I have 34 fields, what must be in element TAGELEMENT ? number 35, or any name SEL, or what ?

After selecting records I want filter this records, apply FILTER for example SET FILTER TO SEL=.T.)

I do not understand, what is nElement in TAGELEMENT nElement, and if is possible apply it to browse database, or only for array

Thanks.

Re: TAGELEMENT in DCBROWSE

Posted: Tue Sep 08, 2015 3:37 am
by skiman
Hi,

Don't use filter after tagging records. Look at dc_setscopearray(). This is very fast, filtering is very slow.

I don't use the tagelement, I can't help with that.

Re: TAGELEMENT in DCBROWSE

Posted: Tue Sep 08, 2015 3:54 am
by Victorio
Now I examine DC_Tagged(),
I used :
SET FILTER TO DBFILE->(DC_Tagged())

after Tagged record.
It look good, but I am not try it on large database.

I will look dc_setscopearray(), thanks.


So excuse me my english : :oops:

Re: TAGELEMENT in DCBROWSE

Posted: Tue Sep 08, 2015 5:50 am
by Tom
If a filter must be used, take a look at SET SMARTFILTER ON. This causes any browsed record to be only checked once for the filter condition. Don't forget to switch it off afterwards. If the data changes, call "DbRefresh()", which resets the smartfilter. It will increase the speed of a database browse. I guess it works quite similar to Roger's scopearray.

Re: TAGELEMENT in DCBROWSE

Posted: Tue Sep 08, 2015 6:19 am
by Victorio
thankĀ“s

Re: TAGELEMENT in DCBROWSE

Posted: Tue Sep 08, 2015 6:38 am
by skiman
Hi Tom,

The system of Roger is very powerfull because you can use a multi-dimensional array. I'm using this to make sorting of a browse superfast.

I search for example for customers which bought the last year. I fill an array with the record number, and in the second element the name of the customer.
Now I can sort the array on the second element, and I get a sorted and selected list.
If I want the same selection now sorted on city, I replace my second element with the city, I sort the array, and I get a sorted list.

The result is Browsing in databases with easy and fast sorting on each column without any index on this columns.

So dc_setscopearray is a lot more than just scoping or filtering. :clap:

Re: TAGELEMENT in DCBROWSE

Posted: Tue Sep 08, 2015 7:22 am
by Tom
Hi, Chris.

I know this, I do use it myself. I just wanted to mention that if there's a need to work this way - to set a filter on a large database browse -, the smartfilter maybe a good idea. We have a system to watch all data coming in through our SOAP-interface connected to our mobile apps. This table can get very large, but sometimes it's needed to set a filter on this (find data containing something, like the license number of a car or even parts of it). The smartfilter increased the speed of this, since the filter condition is only evaluated once for each record. For DC_SetScopeArray(), it is needed to evaluate conditions anyway (once, of course, like with smartfilter). There is a delay with both solutions.
And we can't move those data to an array. It doesn't make any sense.

Re: TAGELEMENT in DCBROWSE

Posted: Tue Sep 08, 2015 11:41 pm
by skiman
Tom,
And we can't move those data to an array. It doesn't make any sense.
Only recordnumbers are moved to the array.

Re: TAGELEMENT in DCBROWSE

Posted: Wed Sep 09, 2015 1:23 am
by Tom
Hi, Chris.

You have to traverse the DBF in this situation anyway. And you have to do this with every possible change - new records, changed records, deleted records. It may be a good solution in some situations, but not in all.