[ColdBox 4.3.0] [CBORM 1.3.0] Criteria Builder Group By

I’ve been trying to get the criteria builder to return a result grouped by a property, but I haven’t had any success.

var c = newCriteria();

c.like(“ProductNameAbr”,"%test%");
c.withProjections(groupProperty=‘ProdCode10’);

data.count = c.count();
data.results = c.list(offset=arguments.offset,max=arguments.max,sortOrder=“ProductNameAbr ASC”);

But it’s not working, even though the generated sql .getSQL() states its in place:
select this.ProdCode10 as y0_ from testtable this_ where this.ProductNameAbr like ? group by this.ProdCode10

What am I doing wrong?

You need to add the property argument as well for selection

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057

I actually came across an odd behavior:
If you leave in c.count() the projection is ignored, like it wasn’t even processed even though getSQL() states its there.
However, if I remove the c.count() it errors (as it should really).
I remember an issue like this before, it had to do with issues with adding count() after the list(), if I remember correctly.

Is this a bug or expected?

Expected, since they are potentially two sql calls in their results.