UD CodeDesc Instead of UD CodeID

Hello,
I have added 4 UD Fields to the PartPlant table PartPlant_UD. These are not ‘Shortchar01’, I created these through ‘User Codes’.
These UD Fields are visible on Part Maintenance->Site->Detail

2024-09-06 14_41_14-Part Maintenance

This is great, I figured out how to show the CodeDesc instead of the CodeID in the field so users can select the CodeDesc instead of the CodeID from the dropdown.
When I look at it in the ‘List’ view of all our Plants it uses the CodeID. How do i change the list views to display the CodeDesc?
2024-09-06 14_45_58-Part Maintenance

You need to get a hold of the grid, and using a bit of code, replace the column with the combo box.

I think I have an example around somewhere, let me see if I can find it.

Thanks ill do some more digging in this area.

If you do have an example i’d love to see it, thanks.

private void SetupNMFCCombo()
{
	try
	{
		string displayField = "Product";
		string valueField   = "NMFCCode";

		List<string> sdl = new List<string>(){ valueField + "~" + displayField };
		sdl.AddRange(nmfcCodes.Select(x => x[valueField] + "~" + x[displayField]).ToList());

		cboNMFCCode = new EpiCombo()
		{
			RetrieveOnActivate = false,
			EpiStaticDataList  = sdl.ToArray(),
			EpiColumns         = sdl.FirstOrDefault().Split('~'),
			ValueMember        = valueField,
			DisplayMember      = displayField
		};

		cboNMFCCode.Font = new Font(cboNMFCCode.Font.Name, 16);
		cboNMFCCode.Width = 800;

		string phantomGridGuid   = "7c8d2d07-d24a-4a4f-b0c2-613e684895d4";
		EpiUltraGrid phantomGrid = (EpiUltraGrid)csm.GetNativeControlReference(phantomGridGuid);

		phantomGrid.DisplayLayout.Bands[0].Columns[fieldAlias_NMFC].ValueList = cboNMFCCode;
		phantomGrid.DisplayLayout.Bands[0].Columns[fieldAlias_NMFC].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
	}
	catch (Exception exOuter)
	{
		LogSystemException(this.GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, "Outer", exOuter);
	}
}

Simply get a hold of the Guid for the Grid then assign your Combo to .ValueList in the _Load event

Example:

EpiUltraGrid grdReleaseList = ((EpiUltraGrid)csm.GetNativeControlReference("ade15bd6-f013-4543-a43d-871071e76021"));
grdReleaseList.DisplayLayout.Bands[0].Columns["smVI_Misc1_CodeID_c"].ValueList = cmbMyComboName;
1 Like

Damn it haso… make him work for it. :rofl:

1 Like

Pretty much it :slight_smile: If you have a combo use it, if not use Kevins snippet above to create one.

1 Like