PO Box 1128 Yorktown Heights, NY 10598
+1 914-407-2442
+1 914-407-2432

Add a Custom EpiDataView in an Epicor Customization

At the class level you need to declare a DataTable to hold your data and the EpiDataView

DataTable dt;
EpiDataView myDV;

In the InitializeCustomCode section you need to initialize the data table and the EpiDataView and add it to the Transaction (oTrans)

myDV = new EpiDataView();
dt = new DataTable();
dt.Columns.Add(new DataColumn(ˮMikeˮ));
dt.Columns.Add(new DataColumn(ˮPeterˮ));
dt.Columns.Add(new DataColumn(ˮMollyˮ));
myDV.dataView= dt.DefaultView;
oTrans.Add(ˮmyDVˮ, myDV);

Now you can bind and use your new EpiDataView as you would anything else in the system. Make sure you are a good citizen and destroy your data table and data view in the destroy custom code function

myDV = null;
dt = null;

Related Posts

1 comment

I wrote very similar code this week for the ResourceGroup form.
I bound the dataview to a new grid.

However when the delete tool is clicked the following error is generated.

There is data in the table. There is no custom code for the delete. Adding and changing work fine.
Any ideas?

Error Detail
============
Object reference not set to an instance of an object.

Stack Trace
===========
at Epicor.Mfg.UI.App.ResourceGroupEntry.Transaction.Delete()
at Epicor.Mfg.UI.App.ResourceGroupEntry.ResourceGroupForm.OnClickDelete()
at Epicor.Mfg.UI.FrameWork.EpiBaseForm.handleToolClick(String tKey, ToolClickEventArgs ea)

Leave a reply