No announcement yet.

Is it possible to turn Group By on and off with a script in v6?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Is it possible to turn Group By on and off with a script in v6?

    Hi everyone,
    I have a question that I think is pretty difficult, so I appreciate any ideas/help/solutions.

    I am using V6. I have a grid, that shows a table that contains a field called 'Category'. I have the grid set up for grouping the grid using this field and the Group By settings. This all works fine. But, I really want to turn this grouping on and off. I have another variable that is [glo_site_cats], which is '1' for grouping and '0' for none grouping.

    Q1 - My question, is there a way in a script or macro to turn group by on and off?

    I am able to turn the Category field on and off, and I thought this might affect the group by, but it does not. Group By shows up even if the Category column is off.

    There is an event in grid, in the Group By, called Category_onGroupBy. There seems to be no help page for this in v6. Anyone know what this does?

    I see that V7 has a Dynamic Group By in the samples, but no tutorial. How does this work? Can I control it using a script, since my users will not be choosing this - it will be from that global setting...

    I am not totally opposed to upgrading, but at such a final point in my development of this system, I tend to want to not open pandora's box up with V7... yet

    My fall-back is to copy my grid app and have to nearly identical versions. One will be with no Group By and the second will have it. I can use the global to decide if the first one should sc_redir to the second or not. Not elegant, but I think it will work if I have to do it that way.

    Q2 - I have second question - with the Group By, it always in my case seems to sort the group By, using alpha order. Can I change this? I actually have a field in the Category table called CatOrder, and I would rather use that to sort the group by field.

    Q3 - Thirdly, is there a way to start the Group By in collapsed mode? That is, with each Category showing with the + next to it, so that they are not expanded by default. Right now, in V6 they are all expanded, which kinda defeats the purpose IMHO...

    I guess my real fall back may have to be to implement my own code in a blank app...something like in the example . I know that is possible, but then that would mean some massive changes to all my various apps involved.

    Anyway, any help is appreciated.

    PS I just looked at the samples again and I see the nested grids might be an alternative... have the category as one grid and then use the tree + to expand the items under each one... looks like they can start as collapsed too. Just a thought.
    Last edited by onmountain; 07-14-2013, 11:17 AM.

  • #2
    Q2: most databases will use an index if it is being used in a GROUP BY statement. So I guess this is the case here as well.

    And a nested grid is generally faster since it opens the subrecords only if the nested grid is opened.