Loading ...

Enumerate Cached Objects

Hello everybody,

today I want to share how to enumerate cahed objects according to some type. 

Imagine you have following declaration:

public PXSelectJoin<PRTran> PaySlipDetails;

And that you need to enumerate them as list of PRTran's in some special way.

In my case I used following instruction:

 

var prTrans = PaySlipDetails.Cache.Cached.Cast<PRTran>().ToList().Where(a => a.IsDeleted.HasValue && !a.IsDeleted.Value).ToList();// we have list of all undeleted pr trans

var sumOtherAdj = prTrans.Where(a => a.EarningType == EarningType.OA.GetEnumDescription() || a.EarningType == EarningType.OD.GetEnumDescription()).Sum(a => a.TotalAmount);

Ready to take your Acumatica development to the next level? If you found this tip on enumerating cached objects helpful, imagine what custom solutions we can build together to streamline your processes! Whether you need advanced customizations, unique integrations, or tailored workflows, our team is here to help. Leave a customization request today and let’s turn your ideas into reality. Your perfect Acumatica solution is just a click away!