Hi Team,
I've added a custom field named "UsrContractAmount" to our project. This field is designed to calculate a value based on certain criteria.
Below is the code related to this field:
Â
#region UsrContractAmount
  ÂPXDBDecimal]
  PXUIField(DisplayName="Contract Amount", Enabled = false)]
  public virtual Decimal? UsrContractAmount { get; set; }
  public abstract class usrContractAmount : PX.Data.BQL.BqlDecimal.Field<usrContractAmount> { }
#endregion
Â
The calculation for this field is performed in the following method:
Â
protected virtual void _(Events.RowSelected<PMProject> e) { var row = (PMProject)e.Row; var rowExt = PXCache<PMProject>.GetExtension<PMProjectExt>(row); PMProject project = e.Row; const int targetAccountGroupID = 35; const string targetGroupCD = "REVREC"; decimal sumContractAmount = 0; if (getBudgetLines == null) return; // Retrieve all the PMRevenueBudget records for the specific groupCD. foreach (PMRevenueBudget costBudget in PXSelectJoin<PMRevenueBudget, InnerJoin<PMAccountGroup, On<PMRevenueBudget.accountGroupID, Equal<PMAccountGroup.groupID>>>, Where<PMAccountGroup.groupCD, Equal<Required<PMAccountGroup.groupCD>>>> .Select(Base, targetGroupCD)) { // Check if the accountGroupID matches the target value (35). if (costBudget.AccountGroupID == targetAccountGroupID && costBudget.ProjectID == project.ContractID) { sumContractAmount += costBudget.CuryRevisedAmount ?? 0m; } }
Â
However, I've encountered an issue where, upon adding this field to a generic inquiry in my project, the field value is not populating for all projects. It seems to be working only for certain generic inquiries.
In the project screen, the field is functioning correctly, but it is not working in the Generic Inquiry.
I would greatly appreciate any assistance or insights you can provide to help resolve this issue.
Best regards,
Sagar