Skip to main content
Question

Problem with Сalculate value in custom field (unbound). NOT visible, read, or accessed in report

  • December 8, 2025
  • 1 reply
  • 9 views

Hi all,
I need your help if posible with two calculate fields (UsrBajioRefNbr, UsrBBVARefNbr). I created these 2 fields in a Customer DAC extension (CustomerEGSAExtension) because I need to calculate its values based on Customer.AcctCD field passed to some helper static method included in BankDigits class, which contain a simple algorithm to obtain the necesary result values. However, I still don´t have the expected values...

Firstly, I tried this using PXFormula, but I couldn’t. This way didn’t work for me in this scenario.

Then, I implement RowSelecting in CustomerMaint graph extension (CustomerMaint_GCBankRefExtension) to calculate or fill those DAC field values (not bound to specific database columns):

#region Row Event Handlers
protected virtual void _(Events.RowSelecting<Customer> e)
{
using (new PXConnectionScope())
{
Customer custm = e.Row;
if (custm != null && !String.IsNullOrEmpty(custm.AcctCD))
{
string bajioRefValue = BankDigits.CalcDV_Bajio(custm.AcctCD);
string BbvaBanamexRefValue = BankDigits.CalcDVBBVABanamex(custm.AcctCD);

var customerExt = custm.GetExtension<CustomerEGSAExtension>();
if (customerExt != null)
{
customerExt.UsrBajioRefNbr = bajioRefValue;
customerExt.UsrBBVABanamexRefNbr = BbvaBanamexRefValue;
}
}
}
}
#endregion

Doing the above wasn´t enough, and additionally, I´ve added the events FieldSelecting<Customer, Customer.acctCD>  in dependingField (AcctCD)

and also FieldDefaulting<Customer, CustomerEGSAExtension.usrBajioRefNbr>  in customFields (usrBajioRefNbr, usrBBVARefNbr).

protected virtual void _(Events.FieldSelecting<Customer, Customer.acctCD> e)
{
Customer row = e.Row;
if (row == null) return;

if (row.AcctCD is object)
{
e.Cache.SetDefaultExt<CustomerEGSAExtension.usrBajioRefNbr>(row);
e.Cache.SetDefaultExt<CustomerEGSAExtension.usrBBVABanamexRefNbr>(row);
}
}



protected virtual void _(Events.FieldDefaulting<Customer, CustomerEGSAExtension.usrBajioRefNbr> e)
{
Customer row = e.Row;
if (row == null) return;

var value = BankDigits.CalcDV_Bajio(row.AcctCD);

// Acuminator disable once PX1047 RowChangesInEventHandlersForbiddenForArgs [Justification]
e.Cache.SetValueExt<CustomerEGSAExtension.usrBajioRefNbr>(row, value);

}

 

I thought that by doing the above, I would be able to assign the values correctly after build and publish the project, but again, it's as if they were still in null when I presented or try to access them in reports, as well as GI.

The primary goal so far is to read the values (UsrBajioRefNbr, UsrBBVARefNbr) in reports. Custom fields are correctly defined in the DAC Customer when I build schema to make a report.
But they haven’t any value assigned from calculation.

 

Thanks is advance for any suggestions and help.

1 reply

Forum|alt.badge.img+1

Hi ​@davielalmanza23 

For unbound fields, you should use the PXUnboundFormula attribute instead of PXFormula.