pdoResources: how to use groupby?


I’m building a wine tastingnote website and I want to get a distinct list of all countries, regions, appellations etc. I was hoping that pdoResources would be able to do it, but I can’t get it to work and I have a really hard time to find any examples or proper documentation… I think it is possible to use &groupBy as it is being presented as a generic pdoTools option, but I do not know how to refer to the column I want it grouped by… So to be clear I want to have a “select distinct” on e.g. the winecountry column.

Here’s an example: give me a list of all countries used in my tasting notes:

&tpl=@INLINE <li>[[+tv.tn-winecountry]]</li>

What am I doing wrong?

Thanks so much --Mike

PS pdoResources seems to work just fine with close to 9000 tasting notes. Simplesearch is a bit slower but still not too bad. When everything’s set up correctly I’ll report back on behavior of a lot of resources, as I have the impression that that information is missing a bit --M.

This property has to be written with a lower case b (–> &groupby) to be processed.

Also, when I test it, there seems to be a problem with the dot (.) in the TV prefix and the dash (-) in the TV-name as well.

You can avoid the TV prefix by setting the property &tvPrefix to empty.

    &tpl=`@INLINE <li>[[+tnWinecountry]]</li>`
1 Like

@halftrainedharry you’re the best. This was indeed the solution… I did not realise that a dash might pose problems?

Changed the dashes of all of my TV’s to underscores - not a big fan of CamelCasing, as the groupBy/groupby error shows :roll_eyes:

Thanks again, I would have given up.

Cheers --Mike