Solved

How to : auto update otomatic value field ?

  • 11 November 2021
  • 8 replies
  • 197 views

hi, i want to ask, what event handler can used to auto update otomatic value field after click order number ?

Example : 

 

after click this in GI

 

field “Available Shipment” will auto update value “3” (formula: Quantity - kuota pengiriman)

Thanks.

icon

Best answer by Naveen Boga 12 November 2021, 08:41

View original

8 replies

Userlevel 5
Badge +1

Decorate the Formal attribute on the Available shipment field something like below 

[PXFormula(typeof(Sub<Soline.Qty, Soline.kuotaPengiriman>))]

 

Happy Coding!

Userlevel 7
Badge +17

Hi @yanuaralfianus37  I agree with Vinay and here are more details. Please find the details below.

  •  PXFormula attribute will work both bound and unbound fields but the PXFormula will NOT will not populate value for the existing records/documents. Until we go and modify the Qty or kuotapengiriman fields “Available for Shipment” will not be updated.

If Available for Shipment field is only display purpose and if it is unbound field I recommend you go with PXDBCalced attribute, this will work for existing records as well as new records.

 

Here is sample example for your reference. 

 public class SOLineExt : PXCacheExtension<PX.Objects.SO.SOLine>
{
#region UsrAvailableForShipment
[PXDecimal]
[PXDBCalced(typeof(Sub<SOLine.orderQty, SOLineExt.kuotapengiriman>), typeof(decimal))]
[PXUIField(DisplayName = "Available for Shipment")]
public virtual decimal? UsrAvailableForShipment { get; set; }
public abstract class usrAvailableForShipment : PX.Data.BQL.BqlDecimal.Field<usrAvailableForShipment> { }
#endregion
}

 

Decorate the Formal attribute on the Available shipment field something like below 

[PXFormula(typeof(Sub<Soline.Qty, Soline.kuotaPengiriman>))]

 

Happy Coding!

hi @Vinay K thanks for the code :thumbsup:

 

Hi @yanuaralfianus37  I agree with Vinay and here are more details. Please find the details below.

  •  PXFormula attribute will work both bound and unbound fields but the PXFormula will NOT will not populate value for the existing records/documents. Until we go and modify the Qty or kuotapengiriman fields “Available for Shipment” will not be updated.

If Available for Shipment field is only display purpose and if it is unbound field I recommend you go with PXDBCalced attribute, this will work for existing records as well as new records.

 

Here is sample example for your reference. 

 public class SOLineExt : PXCacheExtension<PX.Objects.SO.SOLine>
{
#region UsrAvailableForShipment
[PXDecimal]
[PXDBCalced(typeof(Sub<SOLine.orderQty, SOLineExt.kuotapengiriman>), typeof(decimal))]
[PXUIField(DisplayName = "Available for Shipment")]
public virtual decimal? UsrAvailableForShipment { get; set; }
public abstract class usrAvailableForShipment : PX.Data.BQL.BqlDecimal.Field<usrAvailableForShipment> { }
#endregion
}

 

hi @Naveen B thanks for the information, i want to ask, how to convert type data if one of field in PXDBCalced is Int ?.

Userlevel 7
Badge +17

Hi @yanuaralfianus37  PXDBCalced attribute will calculate and returns the decimal value.

Can you please share your Available For Shipment DAC field here.

Hi @Naveen B, this all SS

 

 

i got this error after open SO

Userlevel 7
Badge +17

@yanuaralfianus37  It should be PXDecimal but NOT PXDBDecimal

 

Just like below.


[PXDecimal]
[PXDBCalced(typeof(Sub<SOLine.orderQty, SOLineExt.kuotapengiriman>), typeof(decimal))]
[PXUIField(DisplayName = "Available for Shipment")]

 

 

@yanuaralfianus37  It should be PXDecimal but NOT PXDBDecimal

 

Just like below.


[PXDecimal]
[PXDBCalced(typeof(Sub<SOLine.orderQty, SOLineExt.kuotapengiriman>), typeof(decimal))]
[PXUIField(DisplayName = "Available for Shipment")]

 

 

Hi @Naveen B Thanks for help, This is topic is solved :thumbsup_tone2: .

Userlevel 7
Badge +17

@yanuaralfianus37 Great :) Thanks for sharing the update.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved