Kyle Vanderstoep
Kyle Vanderstoep

Reputation: 771

Getting the value of the base record in a PXSelector

I am trying to add a selector to a field on a DAC Extension (PMChangeOrder), and I need to get a value from the base record to put in a where statement on the PXSelector search. The selector will give the user the ability to put in a new value, or select from the values that have been previously entered, based on the current Project ID. Do I use Current<>? Do I override cache attached? I cant seem to have the selector filter by the current value of projectID.

    public abstract class usrPCONo : PX.Data.BQL.BqlInt.Field<usrPCONo> { }
    [PXDBInt()]
    [PXUIField(DisplayName = "PCO No.", Visibility = PXUIVisibility.SelectorVisible)]
    [PXSelector(typeof(Search4<usrPCONo, Where<PMChangeOrder.projectID, Equal<Current<PMChangeOrder.projectID>>>,
        Aggregate<GroupBy<usrPCONo>>>), typeof(usrPCONo), typeof(PMChangeOrder.description), ValidateValue = false )]
    public virtual int? UsrPCONo
    {
        get;
        set;
    } 

Thanks

Upvotes: 0

Views: 203

Answers (1)

Shamilla
Shamilla

Reputation: 246

The code you provided in your question seems to work correctly. Make sure you have AutoRefresh set to true in the aspx file. This will make it so the records in the selector are automatically refreshed when you open the selector popup to reflect the current ProjectID that the user selected. Without this, if the user opened up the selector popup, changed the ProjectID, then reopened the selector popup the records would still reflect the old value unless the user manually pressed the refresh button in the popup. My guess is that this is what you are experiencing.

<px:PXSelector runat="server" ID="edUsrPCONo" DataField="UsrPCONo" AutoRefresh="True" CommitChanges="True" />

Upvotes: 1

Related Questions