Page 1 of 1

Tagging and filter records

Posted: Mon Jan 11, 2016 5:29 am
by Victorio
Hi,

I want select records with tag, with internal variable, no with field TAG.
(In DCBROWSE I have TAGENABLE and TAGELEMENT 35)

If I tagging records in browser, and then I filter it with set filter to xxx
program show selected records. It is ok.
(I used SET FILTER TO MYDATABASE->(DC_Tagged()) )

But If I have many records (200000-500000), time to show selected records is long.

Also if put field TAG Logical to my database and before opening I have used DC_Rectagclear(), this also is very long time (program show notify about clear tagging...).

I mean use scope, but do not know, what I can use tag variable. Because I have not TAG field in database I cannot index with it and use scope.

Is some other way ?
Thanks

Re: Tagging and filter records

Posted: Mon Jan 11, 2016 8:16 am
by skiman
Hi,

Are you browsing a database? Is so the DC_RecTagToggle() is used to add your tagged records to an array.

Afterwards just use the dc_setscopearray(DC_RecTagToggle()) to set the browse to select the tagged records.

Clearing the array can be done by DC_RecTagToggle({})

Clearing the scope is dc_setscopearray(nil)

Re: Tagging and filter records

Posted: Mon Jan 11, 2016 12:41 pm
by Victorio
Hi Chris,

I am not understand, how I can do it.
I have browse database,
* browse okienko Identifikácie
@pozyid,10 DCBROWSE oBrowseid ALIAS "IDENT" ;
SIZE rozxid,rozyid PIXEL ;
NOSOFTTRACK ;
SCOPE ;
OPTIMIZE ;
CURSORMODE XBPBRW_CURSOR_ROW ;
SCROLLBARHEIGHT 12 ;
TAGENABLE ;
TAGELEMENT 35 ;
TAGCOLOR GRA_CLR_RED, GRA_CLR_YELLOW ;
TAGMODE DCGUI_TAGMODE_CLEAR

DCSETPARENT oBrowseid

* ukážka aj tak sa dá, použiť pre pole premenná z poľa array - info roger donay
*DCBROWSECOL DATA DC_FieldWBlock(pic[1],"1") WIDTH 10;
* HEADER hic[1] PARENT oBrowsepa

* polia preusporiadané aby bolo vidno najprv základné veci
* zistiť, či sa dá povoliť prehodenie polí v browseri podobne ako v exceli
DCBROWSECOL FIELD IDENT->CPACI ;
HEADER "C-PA z IDF" WIDTH znakpixc[1]*14
DCBROWSECOL FIELD IDENT->CPAEI ;
HEADER "E-PA z IDF" WIDTH znakpixc[1]*14
DCBROWSECOL FIELD IDENT->CLVC ;
HEADER "C-PA-CLV" WIDTH znakpixc[1]*7
DCBROWSECOL FIELD IDENT->CLVE ;
HEADER "E-PA-CLV" WIDTH znakpixc[1]*7

etc.

then in toolbar button to "SELECT". First I mark records (with SPACE and mouse click or CTRL and mouse click)
Selected records will be Yellow.

Then click button SELECT, this do
SET FILTER TO IDENT->(DC_Tagged())

records is filtered, show only selected.

I examine clear SET FILTER TO IDENT...m and put DC_SETSCOPEARRAY(DC_RECTAGTOGGLE()), but nothing do, all records is showing. Must I change to browse no database but array ? where is "copy" of tagged records ?

So I mean, more changes in source I must do , ?



Note: I have not TAG field, in database, then, If I understand good, express use DCTAG array ? as a public variable .

Re: Tagging and filter records

Posted: Mon Jan 11, 2016 12:55 pm
by rdonnay
You should use DC_ScopeArray( DC_RecTagArray() )

Re: Tagging and filter records

Posted: Tue Jan 12, 2016 12:59 am
by skiman
Hi,

Sorry, I typed the wrong function as Roger already corrected.
Then click button SELECT, this do
SET FILTER TO IDENT->(DC_Tagged())
Action of this button should be: ident->(DC_ScopeArray( DC_RecTagArray() ))

Re: Tagging and filter records

Posted: Tue Jan 12, 2016 2:25 am
by Victorio
Roger, Chris, thanks, speed with DC_SetScopeArray(DC_RecTagArray()) is super !.
Browse table is ok, only selected view.

But now I have not filtered records for next processing, need change some procedures in source , in cycle for processing records put
do while eof()
if DC_Tagged()
* some process
endif
skip
enddo

this work fine too.

Re: Tagging and filter records

Posted: Tue Jan 12, 2016 3:58 am
by skiman
Hi,

You don't need to check for dc_tagged. With dc_setscopearray only the tagged records are in the list. You also need to use the dc_db... commands.

Code: Select all

ident->(dc_dbgotop())
do while !ident->(dc_eof())
* some process
ident->(dc_dbskip(1))
enddo

Re: Tagging and filter records

Posted: Tue Jan 12, 2016 5:40 am
by Victorio
skiman :
I examine this :
ident->(dc_dbgotop())
do while !ident->(dc_eof())
* some process
ident->(dc_dbskip(1))
enddo

but dc_dbskip no work, I do not understand why. If I use skip and if dc_tagged() .. works.

Also, I do not understant how is define array DCTAGS ? It is multidimensional array ?
How structure have it ?

Next problem is, because I have two way to filtering data, with TAG (mark records) on table, and also with filter.
Then it is problem because records may be filtered by filter and also with tag.

Re: Tagging and filter records

Posted: Tue Jan 12, 2016 7:10 am
by skiman
Hi,

You have ident->(DC_ScopeArray( DC_RecTagArray() )) above dc_dbgotop())?

Re: Tagging and filter records

Posted: Tue Jan 12, 2016 7:13 am
by skiman
Next problem is, because I have two way to filtering data, with TAG (mark records) on table, and also with filter.
Then it is problem because records may be filtered by filter and also with tag.

Code: Select all

ident->(DC_ScopeArray( DC_RecTagArray() ))
ident->(dc_dbgotop())
do while !ident->(dc_eof())
 if eval(bFilter)
   * some process
 endif
ident->(dc_dbskip(1))
enddo