Skip to main content
Solved

Configuring custom selector to use a custom field value

  • February 6, 2025
  • 5 replies
  • 171 views

Forum|alt.badge.img

Hi, I currently have new fields on the Tools screen to make it more useful. I have a custom selector called AMToolMstExt.usrToolLocation and AMToolMstExt.useToolWarehouse. The custom warehouse selector works fine, but I want the selector for the location to show a list of locations that belong to the warehouse contained in the custom warehouse field. 

I am trying to use PXSelector and a BQL to relate the list of locations in the selector to the value stored in AMToolMstExt.usrToolWarehouse.

Here is the current setup for AMToolMstExt.usrToolLocation:

 

Here is the current setup for AMToolMstExt.usrToolWarehouse:

 

Here is what currently happens, with all of the locations in the system showing up: 

In the above example, only the locations starting with ‘03’ should be showing, since ‘03’ is in the custom warehouse selector field.

Best answer by aiwan

@u662 

 

You should update your other selector to read the SiteID field then, you can use the “SubsituteKey = typeof(INSite.siteCD)” to display the value as the siteCD value.

Your selector will look somehting like this:

[PXSelector(typeof(CalibrationHeader.docID),
typeof(CalibrationHeader.docNbr),
typeof(CalibrationHeader.date),
typeof(CalibrationHeader.siteID), SubstituteKey = typeof(CalibrationHeader.docNbr), ValidateValue = false)]

 

5 replies

Forum|alt.badge.img+3
  • Varsity I
  • February 7, 2025

Hi ​@u662 , Hope, this link helps you to load data in one selector from another selector selected value.

 


Forum|alt.badge.img+8
  • Captain II
  • February 7, 2025

Hi ​@u662 

 

Please try changing your siteID to siteCD, these are two different values, ID is the unique key which is usually an integer, and the CD is the masked, more user friendly value, usually what you see on the screen.

 

Aleks


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • February 7, 2025

Hi ​@u662 

 

Please try changing your siteID to siteCD, these are two different values, ID is the unique key which is usually an integer, and the CD is the masked, more user friendly value, usually what you see on the screen.

 

Aleks

@aiwan SiteCD is not a field within INLocation

 


Forum|alt.badge.img+8
  • Captain II
  • Answer
  • February 7, 2025

@u662 

 

You should update your other selector to read the SiteID field then, you can use the “SubsituteKey = typeof(INSite.siteCD)” to display the value as the siteCD value.

Your selector will look somehting like this:

[PXSelector(typeof(CalibrationHeader.docID),
typeof(CalibrationHeader.docNbr),
typeof(CalibrationHeader.date),
typeof(CalibrationHeader.siteID), SubstituteKey = typeof(CalibrationHeader.docNbr), ValidateValue = false)]

 


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • February 11, 2025

@u662 

 

You should update your other selector to read the SiteID field then, you can use the “SubsituteKey = typeof(INSite.siteCD)” to display the value as the siteCD value.

Your selector will look somehting like this:

[PXSelector(typeof(CalibrationHeader.docID),
typeof(CalibrationHeader.docNbr),
typeof(CalibrationHeader.date),
typeof(CalibrationHeader.siteID), SubstituteKey = typeof(CalibrationHeader.docNbr), ValidateValue = false)]

 

This answer from ​@aiwan is ultimately correct. I had to unpublish and then republish to get the changes to work for some reason.

 

Here’s my final code:

Warehouse (AMToolMstExt.usrToolWarehouse)

using PX.Objects.IN;

[PXDBString(30)]
[PXUIField(DisplayName="Warehouse")]
[PXSelector(typeof(Search<INSite.siteID>), typeof(INSite.siteCD), typeof(INSite.descr), SubstituteKey = typeof(INSite.siteCD))]

 

Location (AMToolMstExt.usrToolLocation)

using PX.Objects.IN;
using PX.Objects.AM;

[PXDBString(30)]
[PXUIField(DisplayName="Location")]
[PXSelector(typeof(Search<INLocation.locationCD, Where<INLocation.siteID, Equal<Current<AMToolMstExt.usrToolWarehouse>>>>), typeof(INLocation.locationCD), typeof(INLocation.siteID), SubstituteKey = typeof(INLocation.locationCD), DescriptionField = typeof(INLocation.descr))]