Submitted by jimspoon on 2024/12/03 16:35

Does a TLI that is a context parent sort the same way as TLIs that meet the grid filter?  I have a grid in which the sort order is set to "item desc".  The first TLI shown in the grid is a context parent, i.e. it does not meet the grid filter, though a subitem does.  The item text begins with "2017".  The second TLI shown does meet the filter, and the item text begins with "2024".  Based on the grid sort order of "item desc", the TLI starting with "2024" should appear before the item starting with "2017".  Any idea why these items are not sorting as I expected?  Is the "2017" item not sorting below "2024" because it is a context parent that does not meet the grid filter?

As an experiment, I changed the grid filter so that the "2017" item would meet the filter - I added "OR iditem=74836" to the grid filter so that just that item would be added to the items that meet the filter.  So it is no longer a "context parent" TLI.  Once I made that change, the "2017" item now sorted properly, where I would expect it to be based on the "item desc" sort order.

I have the grid display mode set to "Normal (outline)", "Context Parents" set to 9, Sort set to "Source Items Sort" > 
Source Bar, "item desc", and "Sort Items".

 

Comments

Context parents are added after item sorting is done. This is by-design.

The actual results depends on the display mode (flat, tree-view or outline), each with a specific usefulness. 

Perhaps this page helps explaining how it all works: 1. Grid Display Modes
(if not, perhaps the page needs updating)

If you want sorting be applied to all items, including context parents, you can use the Grid Sort Bar.

Good to know, thanks very much.  Out of curiosity, since the sorting was done before the "2017" context parent TLI was added, what would have caused that item to appear at the top of the grid? 

Since the context parent is not is not considered in the sorting, I guessed that the subitems would determine the sorting of that context parent TLI in the grid.  To test this, I changed each second-level item under that TLI to begin with "0000".  I did a grid refresh, and the item then sorted down towards the bottom of the grid instead of at the top where it was.  That seems to support my idea.  It seems a bit odd that subitems would be sorted against TLIs, and then placed under the added context parent, but it does look like that that might be what is being done.

p.s. I see the example in the manual page you linked me to, where the sort order is "calldate desc", which shows the usefulness of adding the context parents after the sort is done.  Still I haven't wrapped my head around how this works just yet.

 

Hi Left,

  1. TLI 2017: what is/are the sub-items? Most likely it is greater than or equal to 2024
  2. Your understanding w.r.t. sub-items of 2017 seems correct. IQ gets the list of matching items (the list you'd see if the display mode is set to flat and context parents Off) and then adds context parents. The Tree-view is particularly useful for certain use-cases (namely when perfect sorting is required and must "win" over hierarchy as in Outline mode, hierarchy "wins" over proper sort order)
  3. Each of the 6 displays have a use-case (flat, tree, outline, with and without CP). Unlike Ecco, IQ ensures that if the item hierarchy gets in the way of the desired list, another display can be used to achieve it

Thanks, very helpful.  You're right - the "2017" CP TLI has 3 first-level subitems, each meeting the source field and filter, each beginning with alphabetic, not numeric characters.  So they would sort before "2024" with an "item desc" sort.  That's why I prefaced each of these subitems with "0000" to see if the sort order would change, which it did.  I thought changing just the first subitem would do the trick, but it did not - instead it just resorted the three subitems, and the "2017" CP remained at the top of the grid.  When I prefaced all 3 subitems with "0000", the "2017" CP TLI sorted below all the higher numeric values e.g. "2024".  I guess all three had to be prefaced that way because all three met the grid source field and filter criteria.  Maybe if only one had met the source field and filter, that's the only one that would have needed to be prefaced to change the sort.

Not very practical stuff, I know, since there are ways to get the intended results - but it helps to understand IQ sorting and why sometimes I might not get the results I expected.  

Not very practical stuff, I know, since there are ways to get the intended results - but it helps to understand IQ sorting and why sometimes I might not get the results I expected.  

Indeed. Any reason why the 2017 CP is not set with the source field / filter? That would sort correctly without any change to sub-items

 

General Discussion