Add Rows to EpiDataView

at the risk of being picked on…
Is it possible to add rows to an EpiDataView?

I have a dashboard and have data displayed in a grid. I would like to append data to the grid using the same query that created the grid with a different selection filter. I do not see any Methods on the EpiDataView that looked like they could do this

bw

So technically speaking yes you could do this…
A DataView is nothing but a DataTable.defaultView so if you can get a hold of the original dataTable then you can add rows to it all day long.
You can use the DataView.Table property to get the main DataTable… Try this

myEpiDataView.dataView.Table.Rows.Add(xxxx);

Arrgh
Forgot the .dataView

Thanks!

OK, so I have added the rows to the dataView.Table but I can’t get the grids in the dashboard to reflect the changes. I tried every combination of dataview.Notify I could think of and no dice
Strangely what does work is popping up a message box BEFORE the data gets added to the dataView.Table – then the screen gets updated.
This is in a deployed dashboard assembly and trying a ‘refresh’ just loads the dashboard with data again :frowning:
So for now, when the dashboard gets used, they will have to click OK to a message box.

Thanks Jose

haha interesting hack… I’ll see if I can come up with a less intrusive solution

Bernie or Jose -

Were you able to resolve the dashboard to reflect the changes without having the message box before the data gets added?

Thanks,

I notice this has no solution so heres my go at it:

	var HDCaseLink = oTrans.Factory("HDCaseLink");
		var NewRow = HDCaseLink.dataView.AddNew();	
		NewRow.BeginEdit();		
		NewRow["RelatedToFile"] = "CorrectiveActionEntry";
		NewRow["HDCaseNum"] = HDCase.dataView[HDCase.Row]["HDCaseNum"];
		NewRow["Key1"] = 69;
		NewRow["Key2"] = "";
		NewRow["Key3"] = "";
		NewRow["Key4"] = "";
		NewRow["Key5"] = "";
		NewRow["Description"] = "Corrective Acion";
		NewRow["ChangedBy"] = ((Ice.Core.Session)oTrans.Session).UserName;
		NewRow["ChangeDate"]  = DateTime.Now;
		NewRow["ChangeTime"]  = DateTime.Now.Hour;
		NewRow["ExternalLink"] = false;;
		NewRow["Company"] = ((Ice.Core.Session)oTrans.Session).CompanyID;
		NewRow["RowMod"] =  "A";
		NewRow.EndEdit();

2 Likes

I just ran into this problem of a grid not updating/refreshing after I add rows the the data table. What worked for me was resetting the data source:

eugTags.DataSource = edvtags.dataView;
(this was in the the print tag screen).

eugTags was the ultra grid control.

Hope this helps. I spent more hours than I care to figuring this out.