How To Pass Data Into Processing Method With Help Of Lambda Expression
14 June 2019
Hello everybody,
today I want to leave a short note on how to pass some additional parameters into Processing method of processing page with help of lambda expression. Syntax is pretty simple:
public class SSShipmentDateResetter : PXGraph<SSShipmentDateResetter> { public PXFilter<ShipmentFilter> ShipmentFilter; public PXFilteredProcessing<SOShipment, ShipmentFilter> ShipmentsForProcessing; public SSShipmentDateResetter() { var shipmentFilter = ShipmentFilter.Current; ShipmentsForProcessing.SetProcessDelegate(shipments => { ResetDate(shipmentFilter, shipments); }); } public static void ResetDate(ShipmentFilter filter, List<SOShipment> shipments) { } }
for me such approach is a bit easier to use as it involes a bit less amout of typing.
If you want to have even simpler syntax, then following sample also may work for you:
public SSShipmentDateResetter() { var filter = ShipmentFilter.Current; ShipmentsForProcessing.SetProcessDelegate(shipments => ResetDate(filter, shipments)); }
For simplicity sake, I've showed only constructor.