November Happy Hour will be moved to Thursday December 5th.

Better way of getting all carts from two days back?

Vote:
 

I want to retrieve all carts from current and two days back. I retrieve the carts like this:

var cartFilter = new CartFilter()
{
ModifiedFrom = DateTime.UtcNow.AddDays(-2),
ModifiedTo = DateTime.UtcNow,
StartingRecord = 0,
RecordsToRetrieve = 20000
};

var carts = _serializableCartDB.FindCarts(cartFilter);

I could loop over this until I find the cart that I want, by changing StartingRecord for each iteration:

Loop 1: get 0-20000

Loop 2: get 20001...40000

Loop 3: get 40001...60000...found cart I want...now break.


Question is, whether there is an easier way to retrieve all carts in one go?

#197045
Sep 20, 2018 7:39
Vote:
 

No, you are doing it quite correctly - even though I think 20000 is still too much. Loading in batches is a good way to ensure you are not running into performance problems like timeout exception/out of memory exception 

#197046
Sep 20, 2018 8:22
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.