EpiCombo Sorting

follow up question related to EpiCombo sorting. I have one that reads the UserCodes BO and returns the dataset just fine. My codes start with L and W. I’d really like it to sort W-L, rather than L-W.
Out of the box, it seems to sort alphabetically. Is the only way to sort it in reverse to instead use a simple search and specify my whereClause to order by CodeID ascending?

Good question Aaron.

I tried using the SortIndicator of the dropdown - no luck.

I tried sorting the dataset: dsPartAdapter.Tables[0].DefaultView.Sort =dsPartAdapter.Tables[0].Columns[0].ColumnName +" DESC"; - no luck

For the order, we went the hard way. Remade the list with the IDs per the
order we wanted. PITA but it worked for our need at least.

Split the topic,

You can use the Sort property of the Returned Data Table on the beforeDropDown event

Ship Via Code
Before Sort

Sort By Description Descending

private void cmbShipVia_BeforeDropDown(object sender, System.ComponentModel.CancelEventArgs args)
	{
		// ** Place Event Handling Code Here **
                 //The column you are sorting by needs to exist in the Data
		((DataTable)cmbShipVia.DataSource).DefaultView.Sort = "Description desc";
	}

Sorted

2 Likes

Wonderful, thanks all

Ohhhh I see, you are changing the sort on the bound datasource - I tried from the original datasource (from the PartAdapter in my case). Going to give this a try.

Update I get the following error:
Unable to cast object of type ‘Erp.BO.PartListDataSet’ to type ‘System.Data.DataTable’.

Gave this a try with no luck:
((Erp.BO.PartListDataSet)cbPN.DataSource).Tables[0].DefaultView.Sort = ((Erp.BO.PartListDataSet)cbPN.DataSource).Tables[0].Columns[0].ColumnName+" desc";

You want to Grab the the DataTable from that so cast it to a DataSet first and then grab the first table

((DataTable)((DataSet)cmbShipVia.DataSource)).Tables[0].DefaultVie.Sort.... etc

How are you binding your ComoboBox?

With search wizard for adapter then:

Why don’t you use the Standard Epicor lookup for your dropdown? I am confused. What does your code look like and what’s the end goal? (function wise)

Well I’d LOVE to use the predictive search out of the box but my issue hasn’t been resolved with that yet.

I am using a combo as a predictive search for PN.

	private void SearchOnPartAdapterFillDropDown()
	{
		// Wizard Generated Search Method
		// You will need to call this method from another method in custom code
		// For example, [Form]_Load or [Button]_Click

		bool recSelected;
		string whereClause =string.Empty;
		System.Data.DataSet dsPartAdapter = Ice.UI.FormFunctions.SearchFunctions.listLookup(this.oTrans, "PartAdapter", out recSelected, false, whereClause);
	
	
	
	if (recSelected)
		{
			// Set EpiUltraCombo Properties
			this.cbPN.ValueMember = "PartNum";
			this.cbPN.DataSource = dsPartAdapter;
			this.cbPN.DisplayMember = "PartNum";
			string[] fields = new string[] {
					"PartNum","PartDescription"};
			this.cbPN.SetColumnFilter(fields);
	
		}
	//this.cbPN.LimitToList = true;

	}

Is this for some sort of auto complete magic?

1 Like

Set your DataSource to be dsPartAdapter.Table[0];
Then the filtering should work… (maybe) though you are binding your ComBo manually… so maybe not

I knew there was an easier way than rebuilding the UDCodes list.

Hi everyone,

I am also looking to sort out Project ID in an Epicombo. thought it’s a best place to post for quick response.

We have a customized customized dashboard- project revenue forecast. The dashboard contains a drop-down menu, where users can choose a particular project and hit refresh button to get the information on the project. A BAQ at the back end pulls out the information that is shown in the dashboard.

However, the projects do not come in order in the drop-down menu. Therefore, I want to know whether there is any way I can sort the projects in the drop-down bar.

Please let me know if you have some suggestions. Will be looking forward to hearing from you soon.

I have attached screenshots below.