UD Table to Ultragrid

Mine seems to work okay. I am not setting Company, Epicor behind the scenes is still setting that for me just fine in 10.2.600.8. I only set Key1 - Key5. With New Button or Enter, Tab - all seems ok on my 2 grids, but then again they are connected to JobMtl, not to a higher parent.

But maybe I did my initial code differently, letting Epicor handle the add new row natively, and notifying the UI (working with the Adapter, not the grid).

private void grdCutPlan_BeforeRowInsert(object sender, Infragistics.Win.UltraWinGrid.BeforeRowInsertEventArgs args)
{
	// Event handling code generated by wizard.
	args.Cancel = true;
	this.oTrans.SetCurrentEvent(TransactionEvent.AddNewOnNewFromGrid);
	GetNewUD03Record();
}

10.2.600.8

UUGH, I hate looking at code I wrote years ago… that’s probably the problem, looks like it’s littered with events. Why did I do it this way? (ironically I was probably in a hurry and not thinking things through, just flipping the puzzle piece around til it fit :crazy_face:)
Well I should probably rework this at some point, the way you did it makes much more sense.

If you add the Wizard code from scratch, it tends to add in a few more events that it didnt do in 10.0 and E9 so it kind of started out that way I believe in 10.2.

Plus I wanted to support Paste Insert, Paste Update and had to mess with the code a bit more.

// this is new in 10.2 
private void JobMtl_BeforeResetDataViewForUD03(object sender, EventArgs args)
{
	// ** remove ListChanged event handler
	this.JobMtl_DataView.ListChanged -= new ListChangedEventHandler(this.JobMtl_DataView_ListChangedForUD03);
}

private void JobMtl_AfterResetDataViewForUD03(object sender, EventArgs args)
{
	// ** reassign DataView and add ListChanged event handler
	this.JobMtl_DataView = this.JobMtl_Row.dataView;
	this.JobMtl_DataView.ListChanged += new ListChangedEventHandler(this.JobMtl_DataView_ListChangedForUD03);
}


// Before switching to another JobMtl lets save
private void JobMtl_BeforeRowChange(EpiRowChangingArgs args)
{
	// ** Argument Properties and Uses **
	// args.CurrentView.dataView[args.CurrentRow]["FieldName"]
	// args.ProposedRow, args.CurrentRow, args.CurrentView
	// Add Event Handler Code

	if (this._edvJobMtl.Row > -1)
	{
		SaveUD03Record();
	}
}

private void grdCutPlan_BeforeRowInsert(object sender, Infragistics.Win.UltraWinGrid.BeforeRowInsertEventArgs args)
{
	// Event handling code generated by wizard.
	args.Cancel = true;
	this.oTrans.SetCurrentEvent(TransactionEvent.AddNewOnNewFromGrid);
	GetNewUD03Record();
}


private void grdCutPlan_BeforeRowsDeleted(object sender, Infragistics.Win.UltraWinGrid.BeforeRowsDeletedEventArgs args)
{
	// Event handling code generated by wizard.
	args.Cancel = true;
	DeleteUD03Record();
}


private void grdCutPlan_KeyDown(object sender, System.Windows.Forms.KeyEventArgs args)
{
	// Event handling code generated by wizard.
	if (args.KeyCode == Keys.Escape)
	{
		UndoUD03Changes();
	}
}

private void grdCutPlan_GridPasted(object sender, System.EventArgs args)
{
	// Grid Pasting will reset the sort, lets add it back
	grdCutPlan.DisplayLayout.Bands[0].SortedColumns.Add(grdCutPlan.DisplayLayout.Bands[0].Columns["Number20"], true);
	grdCutPlan.DisplayLayout.Bands[0].Columns["Number20"].SortIndicator = Infragistics.Win.UltraWinGrid.SortIndicator.Ascending;
}

As you can see some of the items the Wizard in 10.2 threw in new. Maybe thats why.

Best if you generate Wizard code from scratch in old version and then in new and compare, whats new

I don’t currently have any code to paste…

The problem I’m having if there is two lines on the “Lines Detail” section it will add two new lines on the “Unavailable Parts” section I’m trying to make the section it’s own entity seperate from the lines details but have the same properties e.g when tabbed a new line is added or if the API posts a line another line is created waiting information.

This how far I’ve got

Sales Order.txt (3.1 KB)

Try adding, you will need to register the BeforeRowInsert

private void grdCutPlan_BeforeRowInsert(object sender, Infragistics.Win.UltraWinGrid.BeforeRowInsertEventArgs args)
{
	// Event handling code generated by wizard.
	args.Cancel = true; // We are stopping the default Inf Behaviour
	oTrans.GetNewOrderDtl(); // We are telling oTrans Get me a new OrderDtl Line
}

I’ve added that now but still getting

image

Updated code.Sales Order.txt (3.8 KB)

Where did you add

oTrans.GetNewOrderDtl();

Also can you expand your Details so we can see the full exception image

I added

oTrans.GetNewOrderDtl();

Within

private void grdUnavailableParts_c_BeforeRowInsert(object sender, Infragistics.Win.UltraWinGrid.BeforeRowInsertEventArgs args)
{
// Event handling code generated by wizard.
args.Cancel = true;
this.oTrans.SetCurrentEvent(TransactionEvent.AddNewOnNewFromGrid);
try
{
oTrans.GetNewOrderDtl();
} catch (System.Exception )
{
}
}

I’m no longer getting that error but when I delete a line from Line Details one gets deleted from Unavailable Parts grid and I am unable to tab to create new line :angry:

Is anyone able to help me with this?

export your customization and upload here ? also, on the exception dialog box, what is inside “details”?

what is your end goal?

App.SalesOrderEntry.SalesOrderForm_Customization_SalesOrderV1_CustomExport.7z (36.4 KB)

Thank you.

My end goal is to have the Parts Unavailable to be their own entity because at the moment the lines copy “Line Details” e.g if I create a new line it will add a blank line on “Unavailable Parts” section which I don’t want and I also get an error Part Description is required which I don’t want.

your customization works fine in my version.
out of curiosity, on the 7th post, i noticed you hided lot of key fields.
can you unhide company field and test ?

clarity…do you just want to mimck the line detail functionality on a separate view (unavailable part)?

if so, then you need to map the “unavailable part” section to a ud table.

1 Like

Yes I do want to mimick the Line Details section.

Unavailable Part is apart of OrderDtl_UD

if users manage the “unavailable part”,
you need to bind ud table to the grid as epidataview, and programmtically load/update/create data between ud table and order entry screen on order line actions.

if users not going to edit/add the “Unavailable part” view, you could simply call run a baq and bind the dataset to the grid.

if your intention of this modification is to manage unavailable stock, i hope you considered epicor “cross-dock” functionality

Hi Prakash,

How would I go about getting this from a epidataview and bind it to a BAQ? Would that work by posting the information from the rest api?

Kind regards,
Aaron.

checkout @Carson tutorial on BAQ Dataview Example Video - #2 by Aaron_Moreng to bind and display the data.

I presume your using rest api to store data in ud table with some reference to order/po number.

Yes the data will be posted using REST API from a website so I am wondering how I would create multiple lines in a BAQ based on that Sales Order Number?