I am Creating An App that will allow users to select Drinks From a tablet with in the store. The Store Managers will be able to upload New Drinks from Backendless. The Goal is to have a button For Every Brand however I am unsure of how to stop from Duplicating a button For two Different Drinks.
Originally I was going to Attempt to sort them then Count them but then add the buttons to match but I do not know how have it only Count the Brand Once. I searched Through Backendless's API Documentation and I was unable to find what I needed.
DataQueryBuilder queryBuilder = DataQueryBuilder.create();
Backendless.Data.of( "Location_1" ).getObjectCount( queryBuilder,
new AsyncCallback<Integer>()
{
@Override
public void handleResponse( Integer integer )
{
Log.i( "MYAPP", "found Brands " + integer );
}
@Override
public void handleFault( BackendlessFault backendlessFault )
{
Log.i( "MYAPP", "error - " + backendlessFault.getMessage() );
}} );
You should use the
COUNT
aggregate function and group the results by theBrand
name. The API is described in the doc at: https://backendless.com/docs/android/doc.html#data_countHere's a sample code: