Sometimes when you work on a customization you will need to fill
up EpiUltraCombo control from another table.
I will show you how to do this easily.
·
Add EpiUltraCombo
from the toolbox and bind to the available UD field.
·
You want to bring the data
from an Adapter and fill up the combo.
From
the main menu of the customization tools dialog window select Tools =>
Wizards => Customization Wizards as below:
·
The Customization Code Wizard
dialog window appears.
Select Simple Search and click Lunch Wizard button.
·
The Simple Search Wizard
window appears.
Click Get Adapters button to retrieve all adapters and then choose
the adapter (Here I will select UOMAdapter) and then click Next button.
·
Leave the “DropDowm”
radio box checked and then select your UltrCombo name from the “Custom
DropDown” drop down list and then select the Value and Display field for
the UltraCombo and press finish.
·
This above step will add “SearchOnUOMAdapterFillDropDown()”
method to the custom code.
·
You have to call this
method from another method in custom code and I will call it in the Form_Load
method.
·
From the main menu of customization
tools dialog window select Tools
=> Test code or Press F5 for test your code.
·
If the code tested successfully
then save the Customization and close all windows.
Any way to filter by rows? We have a UD table with categories that we want in the dropdown.
ReplyDeleteYou can add a line of code under Dim whereclause As String = String.Empty that sets the whereclause variable to whatever you require in the same format as SQL.
DeleteExample:
This is using the Customer adapter but will work for any adapter. You will notice that I am getting a dynamic variable from a field on the screen after it has been populated, but you quite easily hard code this also:
Dim recSelected As Boolean
Dim whereClause As String = String.Empty
whereclause = String.Format("GroupCode = '" & txtImportCusGroup.Text & "'")
Dim dsCustomerAdapter As System.Data.DataSet = Epicor.Mfg.UI.FormFunctions.SearchFunctions.listLookup(Me.oTrans, "CustomerAdapter", recSelected, false, whereClause)
If recSelected Then
' Set EpiUltraCombo Properties
Me.NewCRGeneralcbo2.ValueMember = "CustID"
Me.NewCRGeneralcbo2.DataSource = dsCustomerAdapter
Me.NewCRGeneralcbo2.DisplayMember = "Name"
Dim fields() As String = New String() {"Name"}
Me.NewCRGeneralcbo2.SetColumnFilter(fields)
End If
Hope this helps.
Many thanks,
Adam Treadwell
ERP Manager - Aerospace Division
Sigma Precision Components UK Ltd
Adam.Treadwell@SigmaComponents.co.uk
As per my above code, you can add a condition to whereClause in the "SearchOnUOMAdapterFillDropDown()" method.
Delete