Hi!
I started using your new released aggregation functions, but have a little problem. When I set up custom properties, I stopped getting some regular fields.
For example
private final String PROPERTY_COMMENTS_COUNT = "Count(comments) as commentsCount;
final String whereClause = "ownerId = " + "'" + userId + "'";
final DataQueryBuilder queryBuilder = DataQueryBuilder.create();
queryBuilder.setWhereClause(whereClause);
queryBuilder.setPageSize(pageSize);
queryBuilder.setOffset(page * pageSize);
queryBuilder.setProperties(PROPERTY_COMMENTS_COUNT);
I am trying to get full CompanyDto object with one new property. I am getting property, BUT name and description comes as null. For custom class and map also.
What am I doing wrong?
APP ID: EF0C71DB-AC58-3DDB-FF94-C9B10FF8C200
Thanks,
best, Nick.
When you request a count (or use any other aggregate function), you are no longer getting actual objects from the server, instead you’re getting an aggregate value. As a result, individual properties for objects no longer make sense in that context and, as a result, are not returned.
Also, please do not submit private topics as we’d like other users to benefit from the responses to solutions.
Hi Mark, sorry I thought questions with app id should be private only, my mistake.
About the answer, I am getting everything except individual properties, how should I properly handle it, if I also need sorting by aggregate value with pagination, for example?
For example I have Item with rating field that depends on Avg function. I want to get all Items sorted by rating and have this rating field in my response.