Skip to main content
Question

PXSelector and Partial Search


Forum|alt.badge.img

I’m trying to create a custom field with a pxselector where I can type in partial text in the field and it shows the closest values when you do. This does partial text and right in the text box itself.  Most fields do it that are pxselector.  My understanding is that it was a property under aspx that did this.  Under Grid Properties there is a FastFilterFields   Shown below

Its not working for me.  I tried FilterByAllFields too, some fields use that.  What am I missing? 

This is the behavior I am lookign for:  

 

12 replies

Forum|alt.badge.img+2
  • Semi-Pro III
  • 56 replies
  • March 18, 2025

What is your code for this field? Are you able to filter by those columns when you open the search box?


Forum|alt.badge.img

Opening the search is too late for what I’m trying to do.  But yes I can search all fields  

 

#region UsrContactID
[PXDBInt]
[PXUIField(DisplayName="Contact")]
//[ContactRaw(typeof(POOrder.vendorID), WithContactDefaultingByBAccount = true)]
  
[PXSelector(typeof(Search<Contact.contactID, Where<Contact.bAccountID, Equal<POOrder.vendorID.FromCurrent>>>),
    typeof(Contact.contactID), typeof(Contact.displayName),
    SubstituteKey = typeof(Contact.displayName),DescriptionField = typeof(Contact.phone1),  Filterable = true)]
public virtual int? UsrContactID { get; set; }
public abstract class usrContactID : PX.Data.BQL.BqlInt.Field<usrContactID> { }
#endregion


darylbowman
Captain II
Forum|alt.badge.img+13

I believe selectors usually auto-complete on text from either the key (substitute key) or description fields.


Forum|alt.badge.img+2
  • Semi-Pro III
  • 56 replies
  • March 19, 2025
darylbowman wrote:

I believe selectors usually auto-complete on text from either the key (substitute key) or description fields.

I think you’re correct, but I tried his code and it isn’t even doing that. I’m thinking it has to do with the fields defined in the PXSelector.

Edit: That is not the issue. Still working on it.


Forum|alt.badge.img+2
  • Semi-Pro III
  • 56 replies
  • March 19, 2025

@edwardmcgovern53 This should work for you. Shouldn’t need to set the filter fields to anything or filterbyallfields to true. I think maybe the issue was that it was bringing up the contacts without names, so I set it to only bring up the contacts that are people.

            #region UsrContactID
            [PXInt]
            [PXUIField(DisplayName = "Contact")]
            //[ContactRaw(typeof(POOrder.vendorID), WithContactDefaultingByBAccount = true)]

            [PXSelector(typeof(Search<Contact.contactID, Where<Contact.bAccountID, Equal<Current<POOrder.vendorID>>, And<Contact.contactType, Equal<ContactTypesAttribute.person>>>>),
                SubstituteKey = typeof(Contact.displayName), DescriptionField = typeof(Contact.phone1))]
            public virtual int? UsrContactID { get; set; }
            public abstract class usrContactID : PX.Data.BQL.BqlInt.Field<usrContactID> { }
            #endregion


Forum|alt.badge.img

That did not work. Adding a filter for person did not make the partial search work


Forum|alt.badge.img+2
  • Semi-Pro III
  • 56 replies
  • March 19, 2025

Hmm, I’m not sure that is exactly what fixed it, I just assumed that is what fixed it.

You typed exactly what I have above and removed the FilterByAllFields as well as the FastFilterFields?

Edit: This is what it looks like for me

 


Forum|alt.badge.img

Oh wow, I see. Let me clear any settings I changed on the aspx, maybe the filter did work… more to come


Forum|alt.badge.img

As you can see there is a contact that starts with Tes but: 

Clearing settings did not work.  Only code is the add of the field I already posted.  Are you using that in yours just with the filter?  thats what I am doing

 


Forum|alt.badge.img+2
  • Semi-Pro III
  • 56 replies
  • March 20, 2025

Try removing the field from the screen editor, then add it again without modifying anything. The code is working for me when I add it without changing anything.


Forum|alt.badge.img

I already did that.  On Daryl suggestion I also changed both the substitutekey and the description field to be the value I want searched.  Same.   I don’t remember this being that difficult.    #region UsrContactID
[PXDBInt]
[PXUIField(DisplayName="Contact")]
//[ContactRaw(typeof(POOrder.vendorID), WithContactDefaultingByBAccount = true)]
  
[PXSelector(typeof(Search<Contact.contactID, Where<Contact.bAccountID, Equal<POOrder.vendorID.FromCurrent>,
     And<Contact.contactType, Equal<ContactTypesAttribute.person>>>>),
    typeof(Contact.contactID), typeof(Contact.displayName),
    SubstituteKey = typeof(Contact.displayName),DescriptionField = typeof(Contact.displayName))]
public virtual int? UsrContactID { get; set; }
public abstract class usrContactID : PX.Data.BQL.BqlInt.Field<usrContactID> { }
#endregion


Forum|alt.badge.img+2
  • Semi-Pro III
  • 56 replies
  • March 20, 2025

Selectors have been very finicky for me too, I have had many issues with them. I have everything set the same way you do and it is working for me. The only other thing I could think of would be to publish with cleanup and see if that fixes any issues.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings