Question

Acumatica PXSelector cannot get Current another field value in where clause

  • 9 April 2024
  • 4 replies
  • 38 views

Userlevel 2
Badge

I have extension code like this

    #region StateID
    [PXDBString(50, IsKey = true, IsUnicode = true, InputMask = "")]
    [PXUIField(DisplayName = "State ID")]
    [PXDBDefault(typeof(State.stateID))]
    [PXParent(typeof(SelectFrom<State>.
        Where<State.stateID.
        IsEqual<District.stateID.FromCurrent>>))]
        public virtual string StateID { get; set; }
    public abstract class stateID : PX.Data.BQL.BqlString.Field<stateID> { }
    #endregion

 

and in other custom field, I want to select district from state but in district, I cannot filter it by state field. What am I missing ?

    #region UsrDistrict
    [PXDBString(50)]
    [PXUIField(DisplayName="District")]
    [PXSelector(typeof(Search<District.districtID,Where<District.stateID,Equal<Current<State.stateID>>>>),
            typeof(District.districtID),
            typeof(District.name),
            DescriptionField = typeof(District.name))]
        public virtual string UsrDistrict { get; set; }
    public abstract class usrDistrict : PX.Data.BQL.BqlString.Field<usrDistrict> { }
    #endregion

 


4 replies

Userlevel 6
Badge +4

Hi @vannakheng66 

The only thing I can think of is that your usrDistrict field should be part of the primary key (IsKey = true missing). Because you are adding specific districts records to another table, they need to be unique.

Userlevel 7
Badge +8

In UI have you set the Commit Changes = true for the StateID?

Userlevel 2
Badge

It’s solved thank

Userlevel 7
Badge

Hi @vannakheng66 - Can you please share how you solved it? Was it with one of the responses above? If so please mark it as best answer so the member gets credit. Thank you!

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