Skip to main content
Solved

Syntax for Selector/Restrictor for DAC Extension Field


Forum|alt.badge.img
  • Jr Varsity III
  • 20 replies

I’ve seen a few posts & blogs about this topic but still can’t seem to get the syntax correct.  I have a DAC extension table against the Customer DAC named “ZZCustomerExt”.  The Selector/Restrictor attributes for the custom fields work fine in a custom tab on the Customer screen.  I added the same field to an SOOrder DAC extension table (value copies but is changeable), but the syntax isn’t correct for my join.  How do I reference the Customer DAC extension table correctly in order to restrict by another field in that DAC extension (contractCode)?

 

    [PXDBInt()]
    [PXUIField(DisplayName = "Commission Parent")]
    [PXSelector(typeof(Search2<Customer.bAccountID, InnerJoin<ZZCustomerExt, On<ZZCustomerExt.bAccountID, Equal<Customer.bAccountID>>>>),
            typeof(Customer.bAccountID),
            typeof(Customer.acctName),
    SubstituteKey = typeof(Customer.acctCD),
    DescriptionField = typeof(Customer.acctName))]
    [PXRestrictor(typeof(Where<Exists<
    Select<ZZCustomerExt, Where<ZZCustomerExt.bAccountID, Equal<Customer.bAccountID>,
            And<ZZCustomerExt.contractCode.IsGreater<fyContractCode>>>>>>),
                    Messages.CommissionParentIncorrectType, typeof(Customer.customerClassID))]

 

The current error appears to be namespace or type related.  I do have the CustomerExtension referenced in the DAC definition.

Visual Studio Error

 

Thanks!

Best answer by Samvel Petrosov

As a table you typically will provide the actual class that represent the table/DAC that you are extending.

So your code should be something like below.

Please have in mind that I change the first condition to compare the bAccountID to the Current<Customer.bAccountID> as it seems like you are trying to match a record based on the current customer id

 

[PXRestrictor(typeof(Where<Exists<
    Select<Customer, Where<Customer.bAccountID, Equal<Current<Customer.bAccountID>>,
            And<ZZCustomerExt.contractCode.IsGreater<fyContractCode>>>>>>),
                    Messages.CommissionParentIncorrectType, typeof(Customer.customerClassID))]

 

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

8 replies

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

If I am understanding this correctly, you should be able to just add it into your selector definition like below. 

    [PXDBInt()]
    [PXUIField(DisplayName = "Commission Parent")]
    [PXSelector(typeof(Search2<Customer.bAccountID, InnerJoin<ZZCustomerExt, On<ZZCustomerExt.bAccountID, Equal<Customer.bAccountID>>>, Where<ZZCustomerExt.contractCode, Greater<Current<fyContractCode>>>>),
            typeof(Customer.bAccountID),
            typeof(Customer.acctName),
    SubstituteKey = typeof(Customer.acctCD),
    DescriptionField = typeof(Customer.acctName))]

 


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 20 replies
  • March 25, 2025

Thanks for the response.  It’s the same syntax error whether the reference to the DAC extension table with a join is in PXSelector or PXRestrictor, but I want to use PXRestrictor to prevent the user from entering an invalid value directly.  Is the error due to the fact that the DAC extension table ZZCustomerExt is derived from PXCacheExtension instead of PXBqlTable?  If so, is there a way to fix the syntax?  Thanks.


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

Are you able to share the code for ZZCustomerExt?


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 20 replies
  • March 25, 2025

Sure, here it is:  

using System;
using PX.Data;
using PX.Objects.AR;
using PX.Objects.CS;
using PX.Data.BQL;
using PX.Objects.PO;

namespace CustomerExtension
{
    // Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
    // Acuminator disable once PX1011 InheritanceFromPXCacheExtension [Justification]
    [PXCacheName(CustomerExtension.Messages.ZZCustomerExt)]
    [PXTable(typeof(Customer.bAccountID), IsOptional = true)]

    public class ZZCustomerExt : PXCacheExtension<Customer>
    {

        public static bool IsActive()
        {
            return true;
        }

        #region BAccountID
        [PXDBInt(IsKey = true)]
        public virtual int? BAccountID { get; set; }
        public abstract class bAccountID : PX.Data.BQL.BqlInt.Field<bAccountID> { }
        #endregion

        #region PreferredName
        [PXDBString(35, IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "Preferred Name")]
        public virtual string PreferredName { get; set; }
        public abstract class preferredName : PX.Data.BQL.BqlString.Field<preferredName> { }
        #endregion

        #region ContractCode
        [PXDBString(3, IsUnicode = true, IsFixed = true)]
        [PXUIField(DisplayName = "Contract Code", Visibility = PXUIVisibility.SelectorVisible)]
        [PXDefault("A", PersistingCheck = PXPersistingCheck.Nothing)]
        [PXSelector(typeof(Search<CSAttributeDetail.valueID, 
                             Where<CSAttributeDetail.attributeID, Equal<ctrCodeAttribute>>>),
                             typeof(CSAttributeDetail.valueID),
                            DescriptionField = typeof(CSAttributeDetail.description))]

        public virtual string ContractCode { get; set; }
        public abstract class contractCode : PX.Data.BQL.BqlString.Field<contractCode> { }
        #endregion

        #region EmployeeCode
        [PXDBString(1, IsUnicode = true, IsFixed = true)]
        [PXUIField(DisplayName = "Employee Code")]
        [PXSelector(typeof(Search<CSAttributeDetail.valueID,
                             Where<CSAttributeDetail.attributeID, Equal<empCodeAttribute>>>),
                             typeof(CSAttributeDetail.valueID),
                            DescriptionField = typeof(CSAttributeDetail.description))]
        public virtual string EmployeeCode { get; set; }
        public abstract class employeeCode : PX.Data.BQL.BqlString.Field<employeeCode> { }
        #endregion

        #region EstimatedSSWeek
        [PXDBString(2, IsUnicode = true, IsFixed = true)]
        [PXUIField(DisplayName = "Estimated SS Week")]
        [PXDefault("00", PersistingCheck = PXPersistingCheck.Nothing)]         //Add Selector on College value for DEALER?
        [PXSelector(typeof(Search<CSAttributeDetail.valueID,
                             Where<CSAttributeDetail.attributeID, Equal<ssWeekAttribute>>>),
                             typeof(CSAttributeDetail.valueID),
                            DescriptionField = typeof(CSAttributeDetail.description))]
        public virtual string EstimatedSSWeek { get; set; }
        public abstract class estimatedSSWeek : PX.Data.BQL.BqlString.Field<estimatedSSWeek> { }
        #endregion

        #region Gender
        [PXDBString(1, IsUnicode = true, IsFixed = true)]
        [PXUIField(DisplayName = "Gender")]
        [PXSelector(typeof(Search<CSAttributeDetail.valueID,
                             Where<CSAttributeDetail.attributeID, Equal<genderAttribute>>>),
                             typeof(CSAttributeDetail.valueID),
                            DescriptionField = typeof(CSAttributeDetail.description))]
        public virtual string Gender { get; set; }
        public abstract class gender : PX.Data.BQL.BqlString.Field<gender> { }
        #endregion

        #region Birthdate
        [PXDBDate()]
        [PXUIField(DisplayName = "Birthdate")]
        public virtual DateTime? Birthdate { get; set; }
        public abstract class birthdate : PX.Data.BQL.BqlDateTime.Field<birthdate> { }
        #endregion

        #region ShirtSize
        [PXDBString(2, IsUnicode = true, IsFixed = true)]
        [PXUIField(DisplayName = "Shirt Size")]
        [PXSelector(typeof(Search<CSAttributeDetail.valueID,
                             Where<CSAttributeDetail.attributeID, Equal<shirtSizeAttribute>>>),
                             typeof(CSAttributeDetail.valueID),
                            DescriptionField = typeof(CSAttributeDetail.description))]
        public virtual string ShirtSize { get; set; }
        public abstract class shirtSize : PX.Data.BQL.BqlString.Field<shirtSize> { }
        #endregion

        #region ParentsSold
        [PXDBString(1, IsUnicode = true, IsFixed = true)]
        [PXUIField(DisplayName = "Parents Sold")]
        [PXSelector(typeof(Search<CSAttributeDetail.valueID,
                             Where<CSAttributeDetail.attributeID, Equal<parentSoldAttribute>>>),
                             typeof(CSAttributeDetail.valueID),
                            DescriptionField = typeof(CSAttributeDetail.description))]
        public virtual string ParentsSold { get; set; }
        public abstract class parentsSold : PX.Data.BQL.BqlString.Field<parentsSold> { }
        #endregion

        #region HowHeard
        [PXDBString(4, IsUnicode = true, IsFixed = true)]
        [PXUIField(DisplayName = "How Heard")]
        [PXSelector(typeof(Search<CSAttributeDetail.valueID,
                             Where<CSAttributeDetail.attributeID, Equal<howHeardAttribute>>>),
                             typeof(CSAttributeDetail.valueID),
                            DescriptionField = typeof(CSAttributeDetail.description))]
        public virtual string HowHeard { get; set; }
        public abstract class howHeard : PX.Data.BQL.BqlString.Field<howHeard> { }
        #endregion

        #region HowHeardName
        [PXDBString(40, IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "How Heard Name", Enabled = false)]
        public virtual string HowHeardName { get; set; }
        public abstract class howHeardName : PX.Data.BQL.BqlString.Field<howHeardName> { }
        #endregion

        #region HowRecruited
        [PXDBString(2, IsUnicode = true, IsFixed = true)]
        [PXUIField(DisplayName = "How Recruited")]
        [PXSelector(typeof(Search<CSAttributeDetail.valueID,
                             Where<CSAttributeDetail.attributeID, Equal<howRecruitAttribute>>>),
                             typeof(CSAttributeDetail.valueID),
                            DescriptionField = typeof(CSAttributeDetail.description))]
        public virtual string HowRecruited { get; set; }
        public abstract class howRecruited : PX.Data.BQL.BqlString.Field<howRecruited> { }
        #endregion

        #region HowApplied
        [PXDBString(4, IsUnicode = true, IsFixed = true)]
        [PXUIField(DisplayName = "How Applied")]
        [PXSelector(typeof(Search<CSAttributeDetail.valueID,
                             Where<CSAttributeDetail.attributeID, Equal<howAppliedAttribute>>>),
                             typeof(CSAttributeDetail.valueID),
                            DescriptionField = typeof(CSAttributeDetail.description))]
        public virtual string HowApplied { get; set; }
        public abstract class howApplied : PX.Data.BQL.BqlString.Field<howApplied> { }
        #endregion

        #region HighSchoolName
        [PXDBString(40, IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "Name")]
        public virtual string HighSchoolName { get; set; }
        public abstract class highSchoolName : PX.Data.BQL.BqlString.Field<highSchoolName> { }
        #endregion

        #region HighSchoolGradYear
        [PXDBString(4, IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "Grad Year")]
        public virtual string HighSchoolGradYear { get; set; }
        public abstract class highSchoolGradYear : PX.Data.BQL.BqlString.Field<highSchoolGradYear> { }
        #endregion

        #region HighSchoolCity
        [PXDBString(40, IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "City")]
        public virtual string HighSchoolCity { get; set; }
        public abstract class highSchoolCity : PX.Data.BQL.BqlString.Field<highSchoolCity> { }
        #endregion

        #region HighSchoolCountry
        [PXDBString(2, IsUnicode = true, IsFixed = true)]
        [PXUIField(DisplayName = "Country")]
        [PXSelector(typeof(Country.countryID), CacheGlobal = true, DescriptionField = typeof(Country.description))]
        public virtual string HighSchoolCountry { get; set; }
        public abstract class highSchoolCountry : PX.Data.BQL.BqlString.Field<highSchoolCountry> { }
        #endregion

        #region CollegeMajor
        [PXDBString(3, IsUnicode = true, IsFixed = true)]
        [PXUIField(DisplayName = "Major")]
        [PXSelector(typeof(Search<CSAttributeDetail.valueID,
                             Where<CSAttributeDetail.attributeID, Equal<collegeMajorAttribute>>>),
                             typeof(CSAttributeDetail.valueID),
                            DescriptionField = typeof(CSAttributeDetail.description))]
        public virtual string CollegeMajor { get; set; }
        public abstract class collegeMajor : PX.Data.BQL.BqlString.Field<collegeMajor> { }
        #endregion

        #region CollegeGPA
        [PXDBString(3, IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "GPA")]
        [PXSelector(typeof(Search<CSAttributeDetail.valueID,
                             Where<CSAttributeDetail.attributeID, Equal<collegeGPAAttribute>>>),
                             typeof(CSAttributeDetail.valueID),
                            DescriptionField = typeof(CSAttributeDetail.description))]
        public virtual string CollegeGPA { get; set; }
        public abstract class collegeGPA : PX.Data.BQL.BqlString.Field<collegeGPA> { }
        #endregion

        #region CollegeYearInSchool
        [PXDBString(1, IsUnicode = true, IsFixed = true)]
        [PXUIField(DisplayName = "Year In School")]
        [PXSelector(typeof(Search<CSAttributeDetail.valueID,
                             Where<CSAttributeDetail.attributeID, Equal<yearInSchoolAttribute>>>),
                             typeof(CSAttributeDetail.valueID),
                            DescriptionField = typeof(CSAttributeDetail.description))]
        public virtual string CollegeYearInSchool { get; set; }
        public abstract class collegeYearInSchool : PX.Data.BQL.BqlString.Field<collegeYearInSchool> { }
        #endregion

        #region CollegeMajorOtherDesc
        [PXDBString(40, IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "Major Other Desc", Enabled = false)]
        public virtual string CollegeMajorOtherDesc { get; set; }
        public abstract class collegeMajorOtherDesc : PX.Data.BQL.BqlString.Field<collegeMajorOtherDesc> { }
        #endregion

        #region VehicleMake
        [PXDBString(25, IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "Make")]
        public virtual string VehicleMake { get; set; }
        public abstract class vehicleMake : PX.Data.BQL.BqlString.Field<vehicleMake> { }
        #endregion

        #region VehicleModel
        [PXDBString(20, IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "Model")]
        public virtual string VehicleModel { get; set; }
        public abstract class vehicleModel : PX.Data.BQL.BqlString.Field<vehicleModel> { }
        #endregion

        #region VehicleYear
        [PXDBString(4, IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "Year")]
        public virtual string VehicleYear { get; set; }
        public abstract class vehicleYear : PX.Data.BQL.BqlString.Field<vehicleYear> { }
        #endregion

        #region VehicleColor
        [PXDBString(20, IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "Color")]
        public virtual string VehicleColor { get; set; }
        public abstract class vehicleColor : PX.Data.BQL.BqlString.Field<vehicleColor> { }
        #endregion

        #region VehiclePlate
        [PXDBString(10, IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "Plate")]
        public virtual string VehiclePlate { get; set; }
        public abstract class vehiclePlate : PX.Data.BQL.BqlString.Field<vehiclePlate> { }
        #endregion

        #region VehicleMiles
        [PXDBInt()]
        [PXUIField(DisplayName = "Miles")]
        public virtual int? VehicleMiles { get; set; }
        public abstract class vehicleMiles : PX.Data.BQL.BqlInt.Field<vehicleMiles> { }
        #endregion

        #region VisaStatus
        [PXDBString(2, IsUnicode = true, IsFixed = true)]
        [PXUIField(DisplayName = "Visa Status")]
        [PXSelector(typeof(Search<CSAttributeDetail.valueID,
                             Where<CSAttributeDetail.attributeID, Equal<visaStatusAttribute>>>),
                             typeof(CSAttributeDetail.valueID),
                            DescriptionField = typeof(CSAttributeDetail.description))]
        public virtual string VisaStatus { get; set; }
        public abstract class visaStatus : PX.Data.BQL.BqlString.Field<visaStatus> { }
        #endregion

        #region CitizenshipCountry
        [PXDBString(2, IsUnicode = true, IsFixed = true)]
        [PXUIField(DisplayName = "Citizenship Country")]
        [PXSelector(typeof(Country.countryID), CacheGlobal = true, DescriptionField = typeof(Country.description))]
        public virtual string CitizenshipCountry { get; set; }
        public abstract class citizenshipCountry : PX.Data.BQL.BqlString.Field<citizenshipCountry> { }
        #endregion

        #region ResidenceCountry
        [PXDBString(2, IsUnicode = true, IsFixed = true)]
        [PXUIField(DisplayName = "Residence Country")]
        [PXSelector(typeof(Country.countryID), CacheGlobal = true, DescriptionField = typeof(Country.description))]
        public virtual string ResidenceCountry { get; set; }
        public abstract class residenceCountry : PX.Data.BQL.BqlString.Field<residenceCountry> { }
        #endregion

        #region Email2
        [PXDBString(128, IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "Email 2")]
        public virtual string Email2 { get; set; }
        public abstract class email2 : PX.Data.BQL.BqlString.Field<email2> { }
        #endregion

        #region ElectronicTaxForm
        [PXDBBool()]
        [PXUIField(DisplayName = "Electronic Tax Form")]
        [PXDefault(true, PersistingCheck = PXPersistingCheck.Nothing)]
        public virtual bool? ElectronicTaxForm { get; set; }
        public abstract class electronicTaxForm : PX.Data.BQL.BqlBool.Field<electronicTaxForm> { }
        #endregion

        #region ElectronicTaxFormDate
        [PXDBDate()]
        [PXUIField(DisplayName = "Election Date")]
        public virtual DateTime? ElectronicTaxFormDate { get; set; }
        public abstract class electronicTaxFormDate : PX.Data.BQL.BqlDateTime.Field<electronicTaxFormDate> { }
        #endregion

        #region ChargeITServices
        [PXDBBool()]
        [PXUIField(DisplayName = "Charge IT Services")]
        [PXDefault(false, PersistingCheck = PXPersistingCheck.Nothing)]
        public virtual bool? ChargeITServices { get; set; }
        public abstract class chargeITServices : PX.Data.BQL.BqlBool.Field<chargeITServices> { }
        #endregion

        #region ExemptWHFormSigned
        [PXDBBool()]
        [PXUIField(DisplayName = "Exempt W/H Form Signed")]
        [PXDefault(false, PersistingCheck = PXPersistingCheck.Nothing)]
        public virtual bool? ExemptWHFormSigned { get; set; }
        public abstract class exemptWHFormSigned : PX.Data.BQL.BqlBool.Field<exemptWHFormSigned> { }
        #endregion

        #region NoPaymentFee
        [PXDBBool()]
        [PXUIField(DisplayName = "No Payment Fee")]
        public virtual bool? NoPaymentFee { get; set; }
        public abstract class noPaymentFee : PX.Data.BQL.BqlBool.Field<noPaymentFee> { }
        #endregion

        #region OrganizationName
        [PXDBString(35, IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "Organization Name")]
        public virtual string OrganizationName { get; set; }
        public abstract class organizationName : PX.Data.BQL.BqlString.Field<organizationName> { }
        #endregion

        #region PayResiduals
        [PXDBBool()]
        [PXUIField(DisplayName = "Pay Residuals", Enabled = false)]
        public virtual bool? PayResiduals { get; set; }
        public abstract class payResiduals : PX.Data.BQL.BqlBool.Field<payResiduals> { }
        #endregion

        #region SalesManagerAccountID
        [PXDBInt()]
        [PXUIField(DisplayName = "Sales Manager")]
        [PXSelector(typeof(Search<Customer.bAccountID>),
                        typeof(Customer.bAccountID),
                        typeof(Customer.acctName),
                SubstituteKey = typeof(Customer.acctCD),
                DescriptionField = typeof(Customer.acctName))]
        [PXRestrictor(typeof(Where<Customer.customerClassID.IsEqual<dealerCustomerClass>.And<Brackets<
                             ZZCustomerExt.employeeCode.IsEqual<managerEmployeeCode>>>>),
                            Messages.SalesManagerIncorrectType, typeof(Customer.customerClassID))]
        public virtual int? SalesManagerAccountID { get; set; }
        public abstract class salesManagerAccountID : PX.Data.BQL.BqlInt.Field<salesManagerAccountID> { }
        #endregion

        #region StudentManagerAccountID
        [PXDBInt()]
        [PXUIField(DisplayName = "Student Manager")]
        [PXSelector(typeof(Search<Customer.bAccountID>),
                            typeof(Customer.bAccountID),
                            typeof(Customer.acctName),
                SubstituteKey = typeof(Customer.acctCD),
                DescriptionField = typeof(Customer.acctName))]
        [PXRestrictor(typeof(Where<Customer.customerClassID.IsEqual<dealerCustomerClass>.And<Brackets<
                            ZZCustomerExt.contractCode.IsGreater<fyContractCode>>>>),
                            Messages.StudentManagerIncorrectType, typeof(Customer.customerClassID))]
        public virtual int? StudentManagerAccountID { get; set; }
        public abstract class studentManagerAccountID : PX.Data.BQL.BqlInt.Field<studentManagerAccountID> { }
        #endregion

        #region CommissionParentAccountID
        [PXDBInt()]
        [PXUIField(DisplayName = "Commission Parent")]
        [PXSelector(typeof(Search<Customer.bAccountID>),
                        typeof(Customer.bAccountID),
                        typeof(Customer.acctName),
                SubstituteKey = typeof(Customer.acctCD),
                DescriptionField = typeof(Customer.acctName))]
        [PXRestrictor(typeof(Where<Customer.customerClassID.IsEqual<dealerCustomerClass>.And<Brackets<
                            ZZCustomerExt.contractCode.IsGreater<fyContractCode>>>>),
                            Messages.CommissionParentIncorrectType, typeof(Customer.customerClassID))]
        public virtual int? CommissionParentAccountID { get; set; }
        public abstract class commissionParentAccountID : PX.Data.BQL.BqlInt.Field<commissionParentAccountID> { }
        #endregion

        #region Parent1AccountID
        [PXDBInt()]
        [PXUIField(DisplayName = "Parent 1")]
        [PXSelector(typeof(Search<Customer.bAccountID>),
                        typeof(Customer.bAccountID),
                        typeof(Customer.acctName),
                SubstituteKey = typeof(Customer.acctCD),
                DescriptionField = typeof(Customer.acctName))]
        [PXRestrictor(typeof(Where<Customer.customerClassID.IsEqual<parentCustomerClass>>),
                            Messages.ParentIncorrectType, typeof(Customer.customerClassID))]
        public virtual int? Parent1AccountID { get; set; }
        public abstract class parent1AccountID : PX.Data.BQL.BqlInt.Field<parent1AccountID> { }
        #endregion

        #region Parent2AccountID
        [PXDBInt()]
        [PXUIField(DisplayName = "Parent 2")]
        [PXSelector(typeof(Search<Customer.bAccountID>),
                        typeof(Customer.bAccountID),
                        typeof(Customer.acctName),
                SubstituteKey = typeof(Customer.acctCD),
                DescriptionField = typeof(Customer.acctName))]
        [PXRestrictor(typeof(Where<Customer.customerClassID.IsEqual<parentCustomerClass>>),
                            Messages.ParentIncorrectType, typeof(Customer.customerClassID))]
        public virtual int? Parent2AccountID { get; set; }
        public abstract class parent2AccountID : PX.Data.BQL.BqlInt.Field<parent2AccountID> { }
        #endregion

        #region HQAccountID
        [PXDBInt()]
        [PXUIField(DisplayName = "Headquarters")]
        [PXSelector(typeof(Search<Customer.bAccountID>),
                        typeof(Customer.bAccountID),
                        typeof(Customer.acctName),
                SubstituteKey = typeof(Customer.acctCD),
                DescriptionField = typeof(Customer.acctName))]
        [PXRestrictor(typeof(Where<Customer.customerClassID.IsEqual<hqCustomerClass>>),
                            Messages.HQIncorrectType, typeof(Customer.customerClassID))]
        public virtual int? HQAccountID { get; set; }
        public abstract class hqAccountID : PX.Data.BQL.BqlInt.Field<hqAccountID> { }
        #endregion

        #region CollegeAccountID
        [PXDBInt()]
        [PXUIField(DisplayName = "College Attended")]
        [PXSelector(typeof(Search<Customer.bAccountID>),
                        typeof(Customer.bAccountID),
                        typeof(Customer.acctName),
                SubstituteKey = typeof(Customer.acctCD),
                DescriptionField = typeof(Customer.acctName))]
        [PXRestrictor(typeof(Where<Customer.customerClassID.IsEqual<collegeCustomerClass>>),
                            Messages.SalesManagerIncorrectType, typeof(Customer.customerClassID))]
        public virtual int? CollegeAccountID { get; set; }
        public abstract class collegeAccountID : PX.Data.BQL.BqlInt.Field<collegeAccountID> { }
        #endregion

        #region RecCollegeAccountID
        [PXDBInt()]
        [PXUIField(DisplayName = "College Recruited")]
        [PXSelector(typeof(Search<Customer.bAccountID>),
                        typeof(Customer.bAccountID),
                        typeof(Customer.acctName),
                SubstituteKey = typeof(Customer.acctCD),
                DescriptionField = typeof(Customer.acctName))]
        [PXRestrictor(typeof(Where<Customer.customerClassID.IsEqual<collegeCustomerClass>>),
                            Messages.SalesManagerIncorrectType, typeof(Customer.customerClassID))]
        public virtual int? RecCollegeAccountID { get; set; }
        public abstract class recCollegeAccountID : PX.Data.BQL.BqlInt.Field<recCollegeAccountID> { }
        #endregion

        #region NewManagerAccountID
        [PXDBInt()]
        [PXUIField(DisplayName = "New Manager")]
        [PXSelector(typeof(Search<Customer.bAccountID>),
                        typeof(Customer.bAccountID),
                        typeof(Customer.acctName),
                SubstituteKey = typeof(Customer.acctCD),
                DescriptionField = typeof(Customer.acctName))]
        [PXRestrictor(typeof(Where<Customer.customerClassID.IsEqual<dealerCustomerClass>.And<Brackets<
                             ZZCustomerExt.employeeCode.IsEqual<managerEmployeeCode>>>>),
                            Messages.SalesManagerIncorrectType, typeof(Customer.customerClassID))]
        public virtual int? NewManagerAccountID { get; set; }
        public abstract class newManagerAccountID : PX.Data.BQL.BqlInt.Field<newManagerAccountID> { }
        #endregion

        #region ClassificationCode
        [PXDBString(2, IsUnicode = true, IsFixed = true)]
        [PXUIField(DisplayName = "Classification")]
        [PXSelector(typeof(Search<CSAttributeDetail.valueID,
                             Where<CSAttributeDetail.attributeID, Equal<dlrClassAttribute>>>),
                             typeof(CSAttributeDetail.valueID),
                            DescriptionField = typeof(CSAttributeDetail.description))]
        public virtual string ClassificationCode { get; set; }
        public abstract class classificationCode : PX.Data.BQL.BqlString.Field<classificationCode> { }
        #endregion

        #region IRSFormType
        [PXDBString(1, IsUnicode = true, IsFixed = true)]
        [PXUIField(DisplayName = "IRS Form Type", Enabled = false)]
        public virtual string IRSFormType { get; set; }
        public abstract class irsFormType : PX.Data.BQL.BqlString.Field<irsFormType> { }
        #endregion

//      Need to add field for HQAccountType

    }
}

 

 


Samvel Petrosov
Jr Varsity II
Forum|alt.badge.img+5

As a table you typically will provide the actual class that represent the table/DAC that you are extending.

So your code should be something like below.

Please have in mind that I change the first condition to compare the bAccountID to the Current<Customer.bAccountID> as it seems like you are trying to match a record based on the current customer id

 

[PXRestrictor(typeof(Where<Exists<
    Select<Customer, Where<Customer.bAccountID, Equal<Current<Customer.bAccountID>>,
            And<ZZCustomerExt.contractCode.IsGreater<fyContractCode>>>>>>),
                    Messages.CommissionParentIncorrectType, typeof(Customer.customerClassID))]

 


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 20 replies
  • March 25, 2025
Samvel Petrosov wrote:

As a table you typically will provide the actual class that represent the table/DAC that you are extending.

So your code should be something like below.

Please have in mind that I change the first condition to compare the bAccountID to the Current<Customer.bAccountID> as it seems like you are trying to match a record based on the current customer id

 

[PXRestrictor(typeof(Where<Exists<
    Select<Customer, Where<Customer.bAccountID, Equal<Current<Customer.bAccountID>>,
            And<ZZCustomerExt.contractCode.IsGreater<fyContractCode>>>>>>),
                    Messages.CommissionParentIncorrectType, typeof(Customer.customerClassID))]

 

Thanks, but no, I am not trying to match to the current customer.  I am trying to implement a Customer account ID selector for a custom SOOrder extension field, but I need to restrict the result set by a column that is in my Customer DAC extension table ZZCustomerExt which the DAC extension code for the SOOrder extension does not seem to recognize as a DAC/table.


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

He is right about the other part though. Use the base class instead of the extension in the select and then use the extension in the operator.

[PXRestrictor(typeof(Where<Exists<
    Select<Customer, Where<ZZCustomerExt.contractCode.IsGreater<fyContractCode>>>>>),
                    Messages.CommissionParentIncorrectType, typeof(Customer.customerClassID))]

 


Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 20 replies
  • March 25, 2025
DrewNisley wrote:

He is right about the other part though. Use the base class instead of the extension in the select and then use the extension in the operator.

[PXRestrictor(typeof(Where<Exists<
    Select<Customer, Where<ZZCustomerExt.contractCode.IsGreater<fyContractCode>>>>>),
                    Messages.CommissionParentIncorrectType, typeof(Customer.customerClassID))]

 

Thanks for pointing that out! I was distracted by the other change.  Rookie mistake, I couldn’t see it because I’d been fighting too long.  Once I flipped the order, the syntax issue went away.  Thanks to you both!


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