I am running a query on a view entity which results in some datasets. The problem is I want to do a group-by on the resultant dataset. To make it clear, the simplified version of my query is something similar to:
SELECT OBJECT1, OBJECT2 FROM MY_TABLE WHERE OBJECT3=? AND OBJECT4=? GROUP BY OBJECT1.
Here, MY_TABLE
is an existing view entity in the system and I am applying some filters to fetch the relevant data. The code looks something like:
if(UtilValidate.isNotEmpty(productId)) {
andExprs.add(EntityCondition.makeCondition("productId", productId));
}
if( UtilValidate.isNotEmpty(statusId) && !statusId.equalsIgnoreCase("All")) {
andExprs.add(EntityCondition.makeCondition("statusId", statusId));
}
andExprs.add(EntityCondition.makeCondition(
EntityFunction.UPPER_FIELD("issueDate"),
EntityOperator.BETWEEN,
criteria));
andExprsList = EntityCondition.makeCondition(andExprs,
EntityOperator.AND);
quoteList = delegator
.findListIteratorByCondition(dynamicViewForQuotesByProduct, andExprsList,
null, fieldsToSelectForQuotesByProduct, null, null);
My question is how can I group-by
the result returned by this findListIteratorByCondition
. Thanks in advance!