Page 1 of 1

Handling Large Collections in a Table presentation.

Posted: Fri Aug 07, 2009 11:39 am
by ConvertFromOldNGs
by Paul Mathews >> Thu, 10 Dec 1998 1:15:38 GMT

Fast handling large collections in Jade in Tables, diffentiates Jade greatly from SQL based
solutions (remember SQL was originally a reporting tool, not designed for online inquiry of
collections with millions of records).

Previously we have used other busines orientated tools, SPEED II and Progress Version 6 (before they lost the plot in 7, 8 and soon to be 9), which effectively handled this albeit with some limitations (SPEEDII couldn't go backwards, and only forwards from it's start point).

Potentially another benefit of this approach is it will be able an advantages presentation over the web, currently the default for tables over the web is for NO SCROLL BAR, ALL ROWS are displayed. Will test soon when WEB Enable CMSchema and CmBase.

Enough, bumf, the approach is summarised below and the details are downloadable from cmsystemsgroup.com.au.

This is demonstrated in our form FCMTestTemp in CMBase.

CMFTable has been extended to have an iterator reference on it.
This is created, eg aCMFTable[1].myIterator := app.allTest.createIterator;

The CMFTable taTest is set up to ONLY ever have 10 rows (9 of which are displayable).
Hi Grant, again, I am not sure where it is best for this to be posted on the newsgroups, could you add at the appropriate place.

A local collection has been added to FCMTestTemp, zCollection, which is always of size 9.

Hence with this table just need to pageUp, pageDown, home, end, cursorUp (offHome), CursorDown (offEnd) and Reposition. These are all handled in the syncTable Method within CMForm.

The main trick is not to get hungup on the scrollBar, for the Table. At the moment there deliberately is not one. The First,Previous,Next and Last Buttons are enabled on CMForm and their key strokes can be used to move rapidly around the data.

Positioning oneself in a large Table is also demonstrated.

A similar solution for ListBoxes could also be implemented.

In both cases another optional type of ScrollBar which has Up,Previous,Home and End,Next,Down Arrows on it would be more appropriate.

Also at the moment in the iterator I cannot give the position, in showInstance, I could if the startAtObject Method returned the integer Relative position.

Regards,


Paul Mathews - C & M Systems Group
Phone: [612] (99717384) Fax[612] (99711679)
(Dee Why,Sydney,Australia)

Please visit our homepage cmsystemsgroup.com.au.

Re: Handling Large Collections in a Table presentation.

Posted: Fri Aug 07, 2009 11:39 am
by ConvertFromOldNGs
by Martin Sperring >> Fri, 18 Dec 1998 2:42:18 GMT

Paul,
You might find the indexOf method on the Collection Class quite useful, it allows you to work out where you are in a collection.
eg: pos := coll.indexOf(obj);
Martin.

Re: Handling Large Collections in a Table presentation.

Posted: Fri Aug 07, 2009 11:39 am
by ConvertFromOldNGs
by Craig Shearer >> Mon, 4 Jan 1999 23:27:48 GMT

Unfortunately, this doesn't work very well for large collections as the indexOf method seems to perform a sequential search of the collection for the object, which can get pretty lengthy for large collections :-(

Here at Wang, we have a similar control which *does* have a scrollbar attached to it. The control does its best to keep the scrollbar correctly positioned, but there are times when it gets "out of whack". For instance, when the startAtObject method is used, the iterator doesn't have a clue where it is positioned in the collection, so with our implementation, we just stick the thumb of the scrollbar right in the middle. This doesn't really seem to be a problem. When the user starts scrolling the scrollbar, of course it won't be positioned correctly, but we fix up any problems when they get to either end of the scrollbar.

In reality, no user it going to waste their time scrolling through a collection of several thousand entries by clicking on the scrollbar - so as Paul pointed out, it's best not to get hung up about it.

We simply wanted to have a scrollbar so that our table looked just like any other table.

Re: Handling Large Collections in a Table presentation.

Posted: Fri Aug 07, 2009 11:39 am
by ConvertFromOldNGs
by Allistar Melville >> Tue, 5 Jan 1999 13:21:06 GMT

We (here at Focus Business Solutions) have done a similar thing with a custom control that is kind of a cross between a table and a combo
box. It appears like a combo box to the user except that data can be presented in a tabular fashion, which makes it easier for the user to read. This also has a scroll bar, and like the above example, when it
is iterating through a collection, the control only knows when it is
at the top - the bottom - or somewhere in the middle of the
collection.

Allistar.

------------------------------------------------------------------
Allistar Melville (BSc) Home: allistar@ihug.co.nz \_
Software Developer Work: allistar@focussoft.co.nz </'
Auckland, NEW ZEALAND /)
Web: http://homepages.ihug.co.nz/~allistar/ (/`
`
"Take from the church the miraculous, the supernatural, the
incomprehensible, the unreasonable, the impossible, the
unknowable, the absurd, and nothing but a vacuum remains."
[Ingersoll's Works, Vol. 1, p. 285] ------------------------------------------------------------------

Re: Handling Large Collections in a Table presentation.

Posted: Fri Aug 07, 2009 11:39 am
by ConvertFromOldNGs
by Craig Shearer >> Wed, 6 Jan 1999 23:15:44 GMT

Actually, something that I have experimented with before, but forgot to mention, is that it is possible to reasonably efficiently find the approximate position of an object in a collection.

All you have to do is to use the startAtIndex method on the Iterator and do a restricted binary search, starting in the middle, then comparing keys to find out which way to search next. By performing about 5 chops, you can get a pretty accurate indication of where the object is in the collection (accurate to perhaps a few percent). By limiting the number of chops, it remains efficient.

However, I haven't implemented this in any real systems, but it's an interesting idea.

Of course, it would be much better if JADE could implement it (and it would probably be faster too). Perhaps a method called getApproxIndex or something similar?

Craig.

Re: Handling Large Collections in a Table presentation.

Posted: Fri Aug 07, 2009 11:39 am
by ConvertFromOldNGs
by Darrell Duniam >> Thu, 7 Jan 1999 2:46:22 GMT

From JADE 4.1 onwards, you can use the following method of the
Collection class to tell you exactly where in a collection an object is:

indexOf(value : MemberType) : Integer

darrell

Re: Handling Large Collections in a Table presentation.

Posted: Fri Aug 07, 2009 11:39 am
by ConvertFromOldNGs
by Allistar Melville >> Thu, 7 Jan 1999 8:16:37 GMT

We have done exactly that with an array class. The problem we had was that one of our processes requires a collection to be copied to
another collection, but dictionaries take a LOT longer to copy into
than arrays. So we set up an array class with a few binary search
methods that make them appear like dictionaries. Works very fast.

Allistar.

------------------------------------------------------------------
Allistar Melville (BSc) Home: allistar@ihug.co.nz \_
Software Developer Work: allistar@focussoft.co.nz </'
Auckland, NEW ZEALAND /)
Web: http://homepages.ihug.co.nz/~allistar/ (/`
`
"Take from the church the miraculous, the supernatural, the
incomprehensible, the unreasonable, the impossible, the
unknowable, the absurd, and nothing but a vacuum remains."
[Ingersoll's Works, Vol. 1, p. 285] ------------------------------------------------------------------