Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why ArrayList Get only 50 value into Azure Table Storage?

I am getting products list into Azure Table Storage and that product list store in ArrayList and display in Tablelayout..My problem ArrayList get only 50 values.. how to solve this problem. please help me.


   MobileServiceTable<ProductList> ProductBrand = mClient.getTable("ProductList", ProductList.class);


                        ProductBrand.where().field("enable").eq(val(true)).execute(new TableQueryCallback<ProductList>() {

                            public void onCompleted(List<ProductList> results, int count, Exception error, ServiceFilterResponse response) {

                                final ArrayList<ProductList> list3 = new ArrayList<ProductList>();
                                for (ProductList item : results) {
                                    list3.add(item);

                                }
                                for(int c=0;c<list3.size();c++)
                                    Toast.makeText(getBaseContext(),"Size:"+list3.size()+"Product "+list3.get(c).toString(), Toast.LENGTH_SHORT).show();  }
                        });
like image 609
Raja Priyan Avatar asked Feb 06 '26 04:02

Raja Priyan


1 Answers

Azure Mobile Services returns 50 records by default you can get around this by firstly adding the EnableQueryAttribute to your public 'GET' method eg

[EnableQuery(MaxTop(1000)]
public IEnumerable<Product> Get()
{
    ...
}

Now you can use the Take method to request a certain number of products

MobileServiceTable<ProductList> ProductBrand =                                            
              mClient.getTable("ProductList", ProductList.class).Take(1000);

To avoid any paging on the server use the IncludeTotalCount method

like image 168
SWilko Avatar answered Feb 09 '26 09:02

SWilko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!