Epicor User Codes in Drop Down Box Tutorial
Epicor User Codes are a great way to dynamically manage values in a drop down box in Epicor. We use them in many of our customizations, but because the system does not fill properties out for you it is easy to forget how to set them up.
To use User Codes you must add an EpiCombo to a screen or dashboard. I’m not going to cover that process here. This post picks up after EpiCombo has been added. The values are samples and should be updated to match your customization.
You can also use this configuration to pull data from any business object into a EpiCombo box.
Field | Description | Value |
---|---|---|
EpiBinding | On a screen this is the field where the value is stored. This field is not used on dashboard | Customer.ShortChar01 |
DisplayMember | The field you want displayed in the drop down box. | CodeDesc |
EpiBOName | The business object that will be used to retrieve the data. | UserCodes |
EpiColumns | A list of columns you want displayed in the drop down box. For this example leave it blank. | |
EpiDataSetMode | Determines which method to call to retrieve the data. ListDataSet returns less data than RowsDataSet | RowsDataSet |
EpiFieldName | Leave this blank for this example | |
EpiTableName | The table name to retrieve data from. | UDCodes |
RetreiveOnActivate | Set to true to retreive the data when the EpiCombo is activated | true |
ValueMember | The field name that contains the value to be stored. This is usually a key field like CodeID or CustID. | CodeID |
SearchFilter | A where clause to filter the results. For the user code example you want to filter by CodeTypeID this is a value you define when you setup the user codes. | CodeTypeID = ‘CUSTTYPE’ |
Suggested
- Contact us for further assistance
- More blogs by Bryan Sapot
- The Datix Blog
- Learn more about Epicor ERP
So if I just wanted to add a dropdown which contains the values Fire and Water. With binding to OrderRel.ShortChar02 what would my settings look like? Thanks
You set EpiBinding to OrderRel.ShortChar02. Then set EpiStaticDataList to
Fire
Water
If you want to store a code in the database vs the word fire or water use the following:
W~Water
F~Fire
Let me know if you have any other questions.
Your article was pretty helpful in just explaining a few of the controls I hadn’t gotten to learning yet.
I have a need to add a dropdown box based on our Employee names and I got the EpiCombo box working…sort of. There are 132 employee records and it takes about 3.5sec once the dropdown arrow is clicked before the list populates for the user. I am adding Checkbox01 to the EmpBasic table so that I can further whittle this list down to about 85 employees. My question is how do I enter multiple SearchFilter criteria, such as EmpStatus=’A’ AND Checkbox01=TRUE?
Also, is there a way to get the list to populate quicker, or is this a symptom of connecting the EpiCombo box directly to the EmpBasic table? I didn’t see a need for using UserCodes, but if that’s what I need to do to make the code efficient, I will try that.
To expand on this article:
UserCodes are a great way to populate reference fields without taking up a UD table, such as a list of defects in your product that might otherwise be a static list. You could create an epiCombo in a form customization to list defects “Burned; Stretched; Broken” as a static list, but if you add another defect class at a later date “Discolored”, you’ll have to edit all of the combo boxes you added as customizations throughout the system by going back into each one and making the change to the static list. The advantage of using the UserCodes is you can just add a new code to that group by using the User Codes task in utilities, which you can open up to responsible non-developer managers who can edit the fields at their discretion. This also allows for easy population of reporting.
In essence, you get all of the benefits of using a UD table, without actually consuming a table or having to setup additional entry forms. If your reference list becomes very large and you have a lot of other large reference lists, it would be wise to switch to a UD table.
To clarify Alex’s question:
For your purposes of populating employee names, you should not use usercodes. You are going along the correct path of pulling employee names from the EmpBasic table. Depending on how your information is setup, the employee names should be the only data pulled back from the table. There should be a property of the EpiCombo that says query on load or something to that extent, which should populate the combo on load and when you click it on typical use, it should immediately come up. If you want to add filters with a checkbox, I would use an event handler on the checkbox to both update the property of the combo and then requery its contents. If that is not your desired functionality and 3.5 seconds is too slow, I would recommend going through the index compacting procedures provided on Epicweb and possibly recommend a dump and load of the database just to enhance potential performance issues. This isn’t guaranteed to fix anything, but are just some general suggestions.
So could you use the search filter to filter by a value in another custom control on the form that isn’t tied to any database table column? A scenario would be one epicombobox to list warehouses and a second to list bins for the warehouse selected. Both controls’ values will be use to run a custom process and have no need to be stored.
Never mind I figured it out. On the first epicombo for the warehouse valuechanged event, I found I could set in code for the SearchFilter value in code as folliows using VB .NET
cboFromBin_MT.SearchFilter = “WarehouseCode = ‘” & cboFromWhse_MT.Value.ToString & “‘”
Preliminary testing shows it does work.
Wow, amazing blog layout! How long have you been blogging
for? you make blogging look easy. The overall look of your website is magnificent, let alone the content!