Group by not working in getObjectCount function in js query
I want to get ‘count of all objects from a view table on group by basis’
From find function i am getting count till only 100 records
Hi Shahrukh,
It works exactly as designed. Query results in Backendless are paged. Please see API documentation for details:
https://backendless.com/docs/js/data_data_paging.html
Regards,
Mark
Hi Mark,
Yes it is working, but I want to get ‘count of all objects from a ‘view table’ on group by basis’ and query is passing in getObjectCount() function but i am not getting right results
This is code
var queryBuilderData = Backendless.DataQueryBuilder.create();
queryBuilderData.setWhereClause( TestObjectId is not null
);
queryBuilderData.setGroupBy( “TestObjectId” );
let totalCount = await Backendless.Data.of(“TestViewTable”).getObjectCount( queryBuilderData )
in this code the result is same as with setGroupBy() and without setGroupBy()
working with this below url code
https://backendless.com/docs/js/data_get_object_count.html
I believe grouping objects by TestObjectId
is wrong with the getObjectCount
API. If you need to calculate the counts for each group, you should be using the following API call:
https://backendless.com/docs/rest/data_count.html
Hi Mark,
with count i have 100 records limit issue, i want count more than 100
var queryBuilderData = Backendless.DataQueryBuilder.create();
queryBuilderData.setProperties( Count(test_objectId) as totalCount
);
queryBuilderData.setWhereClause(Condition);
queryBuilderData.setGroupBy( “test_objectId” );
//queryBuilderData.setPageSize( 100 );
let totalCount = await Backendless.Data.of(“TestTable”).find( queryBuilderData )
.then( function( result ) {
return result.length;
}
return totalCount;
default-10 and max-100 is the limit
i want to get totalCount from a view table which has rows 5000
total records in tha view table as per above condition is 1200, from above code 1200 not coming
how can i get 1200 totalCount from a table
When you run a query, you get 100 objects in the result. If you need to get more, you modify the offset
and make another query. This is documented in the first link I shared with you.
Thanks Mark