I added an unbound string field to the PM Budget screen. The goal is to present the “PONUMBER” attribute which is tied to a Project Task.
The problem is that my field is showing the same value in the grid for all rows. I think my PXDBScalar search is not correct, but I don’t know why.
This is the DAC extension
using PX.Data;
using PX.Objects.CS;
using SmartRide;
namespace PX.Objects.PM
{
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public sealed class SmartPMBudgetExt : PXCacheExtension<PX.Objects.PM.PMBudget>
{
#region UsrPONumberAttribute
InnerJoin<PMTask, On<PMTask.noteID, Equal<CSAnswers.refNoteID>>,
InnerJoin<PMBudget, On<PMBudget.projectTaskID, Equal<PMTask.taskID>,
And<PMTask.projectID, Equal<PMBudget.projectID>>>>>,
Where<CSAnswers.attributeID, Equal<ICSPONbrAttribute>>>))]
public string UsrPONumberAttribute { get; set; }
public abstract class usrPONumberAttribute : PX.Data.BQL.BqlString.Field<usrPONumberAttribute> { }
#endregion
}
}
I am joining the CSAnswers table to the PMTask table on the PMTask.NoteID. I then join to the PMBudget table where the PMTask fields match the PMBudget fields.
In the Where clause, I am using a class that returns “PONUMBER” to the statement.
This is what I am getting in the grid:
PO Number 0000048749 is displayed on all records.
If I do this login in rowselected, it works. But that is a bad way to do this.
This works:
protected void PMBudget_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
var row = (PMBudget)e.Row;
if (row == null) return;SmartPMBudgetExt ext = row.GetExtension<SmartPMBudgetExt>();
if (ext == null) return;CSAnswers cSAnswers = SelectFrom<CSAnswers>
.InnerJoin<PMTask>.On<PMTask.noteID.IsEqual<CSAnswers.refNoteID>>
.InnerJoin<PMBudget>.On<PMBudget.projectTaskID.IsEqual<@P.AsInt>
.And<PMTask.projectID.IsEqual<@P.AsInt>>>
.Where<CSAnswers.attributeID.IsEqual<ICSPONbrAttribute>>.View.Select(Base, row.ProjectTaskID, row.ProjectID);if (cSAnswers == null) return;
ext.UsrPONumberAttribute = cSAnswers.Value.ToString();
}
Any ideas on what I need to do to my PXDBScalar statement?