How to read information from Acumatica chunk by chunk

Hello everybody,

today I want to leave short fragment of code, which anybody can use for processing records in Acumatica chunk by chunk. By default, everybody in Acumatica including myself uses Select method. Select works quite 

well, but has one limitation: it reads all information that satisfies filtering conditions. But imagine that you need to read not all records, but some limited set i.e. top 5000 records.

Next code fragment shows how to read from table CSalesOrder top 5000 records:

PXSelectReadonly<CSalesOrder,
                    Where<CSalesOrder.CustImportedEqual<False>,
                        And<CSalesOrder.CustomerErrorIsNull>>>.SelectWindowed(this, 0, 5000).
                        Select(x => x.GetItem<CSalesOrder>()).ToList();

SelectWindowed will give you only 5000 records or less, depending what you have in your db.

No Comments

Add a Comment