Forum OpenACS Development: Using Groupby in Listbuilder

Posted by Dave Bauer on
I finally think I figured out how to use groupby with multivar filter type.

You want to do this since it lets you easily reorder the results so grouping actually works.

The documentation is not clear on the format for a multivar filter.

Each filter value has 3 elements {label value count}

So in the case of groupby with multiple values you'd do

groupby {
    type multivar
    values {
        {"Group 1" {{groupby group1} {orderby group1}} }
        {"Group 2" {{groupby group2} {orderby group2}} }

This will almost actually work.

Except multivar does not actually do anything. It should set multiple filters. So in the example it should set groupby to group1 and orderby to group2. It never sets the orderby. Groupby is set by virtue of your choosing the group by filter.

I created a patch (which I'll put on HEAD) that fixes this.