BPM help

Hi all,

I’m reasonably new to BPMs and this one has me stumped. I’m trying to create a Method Directive on ARInvoice.OnChangeMiscCode pre-processing. We have a certain item that we only want to be attached to the last line of an order. I can get the current line through the tt table, but how can I test the total number of lines for the current order?

I’m sure it’s simple, but so am I!

Thanks in advance.

Hi Ryan,

For getting total number of lines(Count) or aggregate functions, you can use the below sample code with respective parameters.

var ShipDtl1 = (from poRD1 in Db.ShipDtl where poRD1.Company == Session.CompanyID && poRD1.OrderNum == OrderNum && poRD1.OrderLine == OrderLine && poRD1.OrderRelNum == OrderRelNum1 select poRD1.OurInventoryShipQty).Sum();
decimal ShippedQty = Convert.ToDecimal(ShipDtl1);

Here ShippedQty variable will have the Sum of OurInventoryShipQty. in your case you can use Count() function.

Thanks Susai. Worked like a charm!