Skip to main content
Solved

Making the selector show the CD - Description rather than just the CD


Joe Schmucker
Captain II
Forum|alt.badge.img+3

I have a selector that, after you select a value, only shows the “CD” of the field.  I want it to show the “CD - Description”.

When you click the lookup, you see this:

After you select a row, you see this:

I want it to show T1 - test1

Note that if I add DescriptionField = typeof(SSGCRServiceType.description))], the field clears out after the row is selected.  I don’t know why that occurs.  Maybe because the field value in the table is int?

Does anyone know what I need to modify in this select statement to make this happen?

#region UsrServiceTypeID
[PXDBInt]
[PXUIField(DisplayName = "Service Type", Required = true)]
[PXDefault(PersistingCheck = PXPersistingCheck.Null)]
[PXSelector(typeof(Search2<SSGCRServiceType.serviceTypeID, 
   InnerJoin<SSGCRServTypeRecTypeXR, 
   On<SSGCRServTypeRecTypeXR.serviceTypeID.IsEqual<SSGCRServiceType.serviceTypeID>>>,
   Where<SSGCRServTypeRecTypeXR.recordTypeID.IsEqual<CRCaseExt.usrRecordTypeID.FromCurrent>.
	   And<SSGCRServiceType.isActive.IsEqual<True>>.
	   And<SSGCRServTypeRecTypeXR.isActive.IsEqual<True>>>>),
	typeof(SSGCRServiceType.serviceTypeCD),
	typeof(SSGCRServiceType.description),
	SubstituteKey = typeof(SSGCRServiceType.serviceTypeCD))]
public virtual int? UsrServiceTypeID { get; set; }
public abstract class usrServiceTypeID : PX.Data.BQL.BqlInt.Field<usrServiceTypeID> { }
#endregion

 

 

 

Best answer by Naveen Boga

HI @joe21  You can DescriptionFiled after SubstituteKey like below

 

        #region UsrServiceTypeID
        [PXDBInt]
        [PXUIField(DisplayName = "Service Type", Required = true)]
        [PXDefault(PersistingCheck = PXPersistingCheck.Null)]
        [PXSelector(typeof(Search2<SSGCRServiceType.serviceTypeID,
           InnerJoin<SSGCRServTypeRecTypeXR,
           On<SSGCRServTypeRecTypeXR.serviceTypeID.IsEqual<SSGCRServiceType.serviceTypeID>>>,
           Where<SSGCRServTypeRecTypeXR.recordTypeID.IsEqual<CRCaseExt.usrRecordTypeID.FromCurrent>.
               And<SSGCRServiceType.isActive.IsEqual<True>>.
               And<SSGCRServTypeRecTypeXR.isActive.IsEqual<True>>>>),
            typeof(SSGCRServiceType.serviceTypeCD),
            typeof(SSGCRServiceType.description),
            SubstituteKey = typeof(SSGCRServiceType.serviceTypeCD), DescriptionField = typeof(SSGCRServiceType.description))]
        public virtual int? UsrServiceTypeID { get; set; }
        public abstract class usrServiceTypeID : PX.Data.BQL.BqlInt.Field<usrServiceTypeID> { }
        #endregion

View original
Did this topic help you find an answer to your question?

2 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3381 replies
  • Answer
  • June 23, 2022

HI @joe21  You can DescriptionFiled after SubstituteKey like below

 

        #region UsrServiceTypeID
        [PXDBInt]
        [PXUIField(DisplayName = "Service Type", Required = true)]
        [PXDefault(PersistingCheck = PXPersistingCheck.Null)]
        [PXSelector(typeof(Search2<SSGCRServiceType.serviceTypeID,
           InnerJoin<SSGCRServTypeRecTypeXR,
           On<SSGCRServTypeRecTypeXR.serviceTypeID.IsEqual<SSGCRServiceType.serviceTypeID>>>,
           Where<SSGCRServTypeRecTypeXR.recordTypeID.IsEqual<CRCaseExt.usrRecordTypeID.FromCurrent>.
               And<SSGCRServiceType.isActive.IsEqual<True>>.
               And<SSGCRServTypeRecTypeXR.isActive.IsEqual<True>>>>),
            typeof(SSGCRServiceType.serviceTypeCD),
            typeof(SSGCRServiceType.description),
            SubstituteKey = typeof(SSGCRServiceType.serviceTypeCD), DescriptionField = typeof(SSGCRServiceType.description))]
        public virtual int? UsrServiceTypeID { get; set; }
        public abstract class usrServiceTypeID : PX.Data.BQL.BqlInt.Field<usrServiceTypeID> { }
        #endregion


Joe Schmucker
Captain II
Forum|alt.badge.img+3
  • Author
  • Captain II
  • 443 replies
  • June 23, 2022

Hi @Naveen Boga 

Dude...I SWEAR that I tried that and when I put that line in, the field kept clearing itself out as soon as the row was selected from the selector.

I just put it back in and it works now.  In my initial post above, I mentioned that I had a problem when I tried using that.  

I guess I just needed you to tell me to do it again.

Thanks Naveen.


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