Add custom field to existing grid

I know this has been discussed a bit, but I can’t seem to find a solution. I thought this would be fairly simple, but apparently I am too simple. I added a custom field to the VendPart table. I want to display that field in the data grid in Purchase Advisor on the “Do I have supplier price lists?” tab. When I try to modify the collection, the custom field (DatePriceChg_c) isn’t present. How do I bring a custom field into that collection?

Unfortunately it seems this grid uses a temp table, very similar to VendPart but not defined as such.
I believe this is why it is not pulling UD fields related to VendPart.

I don’t know what you can do to add fields to this table, what you might be able to do is get the UD data and replace an existing but useless to you field with this info through a BPM.

1 Like

Using the Below code in initialization you can add Field in Grid, Next on the Grid value change method you can populate required values in new columns.

EpiUltraGrid ultraGrid1 ;
ultraGrid1 = (EpiUltraGrid)csm.GetNativeControlReference(“8983fa11-7f75-4c9c-bdd5-fdf8f0adc931”);
ultraGrid1.DisplayLayout.Bands[0].Columns[“Select”].DataType = typeof(System.Boolean);

Thank you, I will try this. I assume I would replace “ultraGrid1;” with the name of the actual grid?

ultraGrid1 is fine, what you would change is the guid in the call to GetNativeControlReference and the Name/Caption to something other than Select/Select

I’ve used Jose’s method many times with great success

Fakhruddin, I am able to make a new column appear using the code you provided, but I can’t seem to get the field to populate. I receive an error:
“Inner Exception Message: Key not found: ‘VendPart_DatePriceCh_c’
Parameter name: key”

The field I am trying to display is DatePriceCh_c from the VendPart table. Not sure how to represent it in the code you provided. Here’s what I have right now:

	public void InitializeCustomCode()
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		// End Wizard Added Custom Method Calls
			EpiUltraGrid ultraGrid1;
			ultraGrid1 = (EpiUltraGrid)csm.GetNativeControlReference("d60f5e77-ba3e-490b-904d-cb62c4b48d45");
			ultraGrid1.DisplayLayout.Bands[0].Columns.Add("Date Price Change","DatePriceCh_c");
			ultraGrid1.DisplayLayout.Bands[0].Columns["VendPart_DatePriceCh_c"].DataType = typeof(System.Boolean);

Thank you Randy, Jose’s method worked for me as well. I’m still curious about Fakhruddin’s method as well.

1 Like