Skip to main content

Hello,

          With other’s help, I was able to add a selector of employees on shipment screen.
I’ve created an employeeclass (Which is referred to VendorClassID in DAC) named “PICKER”,

I’d like to limit the selector only shows the employees from “PICKER”,

I write the below code, but it gives out errors:

 

oPXSelector(typeof(Search<EPEmployee.bAccountID,
Where<EPEmployee.vendorClassID,Equal<"PICKER">>>),
 typeof(EPEmployee.acctCD), 
typeof(EPEmployee.acctName), 
typeof(EPEmployee.vendorClassID),
SubstituteKey = typeof(EPEmployee.acctCD))]

 

 

       What is the right way to write the codes. Please advise. Thank you.

Hi @ray20 

We can not pass directly that value, and for this, we need to use SQL constants.

Please use the below code and check….

public class SQLConstants

{
 public class PICKER : PX.Data.BQL.BqlString.Constant<PICKER>
        {
            public PICKER() : base("PICKER") { }
        }

}

/PXSelector(typeof(Search<EPEmployee.bAccountID,
Where<EPEmployee.vendorClassID,Equal<SQLConstants.PICKER>>>),
 typeof(EPEmployee.acctCD), 
typeof(EPEmployee.acctName), 
typeof(EPEmployee.vendorClassID),
SubstituteKey = typeof(EPEmployee.acctCD))]


The code that you’re looking for is something like this:

#region HelperClasses    

    private class string_PICKER: Constant<string>    

    {

        public string_PICKER():base("PICKER"){}

    }      

#endregion

Then, in your field code you’ll reference that custom class:

Where<EPEmployee.vendorClassID,Equal<class_PICKER>>>),

Now, I typically use the “Convert To Extension” button under the Data Access group to turn the automatically generated code to files under the Code group and that’s where I’d place the code that I wrote above. But I’m not sure where you’d place that code while keeping your code organized in the way that your project currently shows. Other people might be able to help there.

Edit: Naveen has shown you the same thing but done a litte more correctly. :)


@Naveen B @ddunn 
Thank you , experts. Really, really appreciate. Codes are working.


@ray20  Great 🙂 Thanks for sharing the update.


Reply