Skip to main content
Answer

Acumatica PXSelector cannot get Current another field value in where clause

  • April 9, 2024
  • 4 replies
  • 146 views

Forum|alt.badge.img

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

 

Best answer by Leonardo Justiniano

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.

4 replies

Leonardo Justiniano
Jr Varsity II
Forum|alt.badge.img+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.


aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • April 9, 2024

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


Forum|alt.badge.img
  • Author
  • Freshman II
  • April 10, 2024

It’s solved thank


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • April 10, 2024

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!