Filtering a manually created queue

So I have 1 queue with approx 25K records in it that’s built from a number of different sources. Now I need to filter the queue, to hide/show entire rows at runtime.
Since this is all hand code and not based on any file definition/dictionary/view the only way I can think of to do that is using a VLBproc, but if I do that I’m not sure how I make the list not show the record at all?
Or am I heading down the wrong path here?

1 Like

Your life will be a lot simpler if you just maintain a 2nd queue and display that. Whatever passes the filter goes into q #2.

Or just create a queue of pointers. Then use that for the get() in the vlb

2 Likes

I agree with Jeff. Without using VLB, the list will always show all rows in the underlying queue.
If performance allows it, I’d use two queues. One with everything and one on the list control that has the filtered rows.
If performance won’t allow that, then I think the only route is to use VLB.

Might building a Memory table instead of a queue be possible? Using a browse queue or any queue to hold filtered records would then be easy.

2 Likes

Well 2 queue’s is quicker for me to code, so that’s what I’m going with. Thanks!

I agree the 2 Queues is the way to go.

IIRC there was a Clarion Mag article on filtering Queues by using a Tree control in the LIST to hide records. The records to be filtered out where assigned to Level 2. The records to show were Level -1, the negative folding the branch closed so level 2 did not show. The expand boxes have to be hidden and code to prevent expanding. There was not really a tree, its just use to hide records.

Clarion Mag is hard to search so I did not put much effort into finding it

1 Like

Hi Carl

possibly this:

Filtering Hand Coded Lists Using The TREE Attribute
By S Jayashankar
Posted April 25 2011

cheers

Geoff R

1 Like

So a 2nd queue is simple enough, but the VLB isn’t that hard. Just add “Ordinal Long” to the queue. Then in the VLB, instead of get(Q, row), you’d do a q.ordinal = row; get(q, q.ordinal)

Either way you still loop over the Q, evaluate the filter and either copy to the displayQ or set/clear the ordinal

1 Like

Meanwhile, she’s already done, kicking it on the beach. :slight_smile:

1 Like

Here is the afore mentioned tree level technique you can use to selectively display entries from a single queue, just ensure that one-based tree is disabled.

The following example shows that when a queue entry has dwLevel = -1, any entry that follows it that has an ABS(dwLevel) greater than 1 (ie: where -1 normally indicates the collapsed branch) will not show. In the example, “Line 3” and “Line 4” do not appear.

So conditionally hiding queue entries can be achieved by careful control of the dwLevel field.

ListTest       PROCEDURE

myQ               Queue 
MainText             String(64)
dwLevel              LONG
              .

Window            WINDOW('Caption'),AT(,,230,201),GRAY,FONT('Microsoft Sans Serif',8)
                 BUTTON('Close'),AT(166,178,42,14),USE(?CancelButton),STD(STD:Close)
                 LIST,AT(25,26,182,148),USE(?LIST1),FONT('Segoe UI',10),FROM(myQ),FORMAT('20L(2)|MT(BI)~Main Te' & |
                    'xt~@s64@')
              END

   CODE
  myQ.MainText = 'Line 1'
  myQ.dwLevel = 0
  Add(myQ)
  
  myQ.MainText = 'Line 2'
  myQ.dwLevel = -1
  Add(myQ)
  
  myQ.MainText = 'Line 3'
  myQ.dwLevel = -2
  Add(myQ)

  myQ.MainText = 'Line 4'
  myQ.dwLevel = 2
  Add(myQ)
           
  myQ.MainText = 'Line 5'
  myQ.dwLevel = 1
  Add(myQ)
  
  !SORT(myQ,myQ.dwLevel)
  
  Open(Window)
  ACCEPT
  .
  Close(Window)

Julian

1 Like

I think I did try this once but IIRC gave up. It complicates sorting as you must keep the Levels “correct”. One simple thing the Level 2 rows need to be -2 so they appear after -1 when Sort(Q,Level)

I also think the Proportional Thumb (PROP:PropVScroll) does not work well with Tree Lists.

I attached the article, thanks Geoff!

cmag-2011-04.pdf (2.1 MB)

I think this page lists all the CMag articles:

https://clarionmag.jira.com/wiki/plugins/viewsource/viewpagesrc.action?pageId=404637

1 Like