Today I want to discuss with you a ways to define selectors and data for them.
In this case system will automatically select value from database Carrier table and show list of Carrier IDs to user.
In this case you have 2 potential problems:
- you should have a database table, otherwise you will see an error.
- There is no way to dynamically change or adjust data that is returned to user
- You can limited configurations to control selector behavior.
To solve these problem Acumatica has a Custom Selector attributes:
public class CustomerPriceClassAttribute : PXCustomSelectorAttribute
this.DescriptionField = typeof(ARPriceClass.description);
protected virtual IEnumerable GetRecords()
foreach (ARPriceClass pc in PXSelect<ARPriceClass>.Select(this._Graph))
yield return pc;
In this case you see that you have simple attribute, that is really similar to the attribute for first example. Using GetRecords method you can create a custom BQL querry, select any data you want, apply any filter and return it as a IEnumberble collection.
In the user interface you will see exactly data provided by your custom query.
Some tips and Ideas:
- In the GetRecords method you can return data that does not exists in the database.
- Acumatica works with GetRecords delegate absolutely the same way how it works with data view delegate, this means that you may use all the same tricks there. For example if you return nothing or you method is void, you can modify base view using WhereAnd, WhereOr, WhereNew and other methods. To get base view use PXView.View;
- You also can override DescriptionFieldSelecting event to control what value will be returned back as a description of current record.
- All standard selector configuration properties can be configured through custom selector constructor.
Integration services provider custom selector attribute:
Company custom selector attribute:
Have a nice development!