MES FKV to show operation comment text

I am still getting the no row error.

private void LaborDtl_AfterRowChange(EpiRowChangedArgs args)
{
	// ** Argument Properties and Uses **
	// args.CurrentView.dataView[args.CurrentRow]["FieldName"]
	// args.LastRow, args.CurrentRow, args.CurrentView
	// Add Event Handler Code
	var view = ((EpiDataView)(this.oTrans.EpiDataViews["LaborDtl"]));
	string job = view.dataView[view.Row]["JobNum"].ToString();
	JobOperSearchAdapter adapterJobOperSearch = new JobOperSearchAdapter(oTrans);
	adapterJobOperSearch.BOConnect();
	adapterJobOperSearch.GetByID(job);
	var row = adapterJobOperSearch.JobOperSearchData.JobOper.Rows[0];
	string job1 = row["JobNum"].ToString();
	MessageBox.Show(job1);
	adapterJobOperSearch.Dispose();
}

First before you check the row, ensure the GetByID is returning true.

Second, make a BAQ against the JobOper table and query for that job# and ensure that there is in fact a JobOper there

I am getting a true value for GetByID(job), and the BAQ shows records for the job.

Ah, i believe this might be the issue… Looks like the GetByID for that adapter requires three params

image
which translates to:
image

So to use the GetByID on that particular adapter, you need something like:
adapter.GetByID(new object[]{“job”,assySeq, opSeq});

if you need something more flexible, you might consider a GetRows with a whereclause

Teach us how to use that master!!

This is exactly what I need, the only issue I’m having is converting AssemblySeq and OprSeq to integers. Example: int asm = view.dataView[view.Row]["AssemblySeq"].???

SearchOptions optsTrans = new SearchOptions(SearchMode.AutoSearch); 
optsTrans.PageSize = 100; //return this many (can call more later)
string whereTrans = string.Format("JobNum = '{0}'" , JobEdit.Text); 
optsTrans.NamedSearch.WhereClauses.Add("JobOper",whereTrans); 
var trans =myAdapter.GetRows(optsTrans,out more);


int asm = (int)view.dataView[view.Row][“AssemblySeq”];

It’s working! Thank you so much!

1 Like

I’m going to open this one up again…an issue I’ve noticed is that because it’s triggered by AfterRowChange, it won’t work if there is only one row (one job clocked in).

Maybe you could add another condition to handle when the first row is added. You could use EpiViewNotification event. Condition AddRow event and a RowCount = 1

I’ve grappled with this for a while now, looking at quite a few threads, and I’m not sure how to get the RowCount. It looks like it’s an attribute of the DataView, but not sure on the syntax.

view.dataView.Count

Hmmmm…the code is compiling, but it’s not triggering when I clock in to a job, and it’s not triggering if I login when there is a job already clocked in. Is there an event that fires when a row is clicked, even if it doesn’t change?

I ran a check on MESMenu_Load and the message box isn’t showing up.

var view = ((EpiDataView)(this.oTrans.EpiDataViews["LaborDtl"]));
if (view.dataView.Count == 1)
{
	MessageBox.Show("!!!");
}

I was suggesting using the epiviewnotification event (from the wizard, on the edv in question)

private void edvPart_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
	{
		// ** Argument Properties and Uses **
		// view.dataView[args.Row]["FieldName"]
		// args.Row, args.Column, args.Sender, args.NotifyType
		// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
		if ((args.NotifyType == EpiTransaction.NotifyType.AddRow))
		{
			if ((args.Row = 0))
			{
					//Do your stuff
			}
		}
	}

Sorry late to party on this one but what is it specifically that you are trying to achieve Fred as I had to do something similar.

Our scenario we wanted the comment text to appear on screen and require clicking ok when the operator logged into the specific operation - does this every time they log into the op for that job - if there is no operation nothing displays and for certain ops where we do mass clock ins (cutting ops) it does not display. We also display the next operation when clocking the op off. We use this for when parts are sent ahead without the route card only a sticker flagging the job. Our shop folks also lose route cards - this enables them to still see specific comments.

My code is pretty brutal and uses standard Epicor text boxes but it might meet your needs.

That’s what I set up, but it wasn’t working so I was doing a check to see how many rows it was counting.

if ((args.NotifyType == EpiTransaction.NotifyType.AddRow))
{
    if ((args.Row == 0))
    {
        var view2 = ((EpiDataView)(this.oTrans.EpiDataViews["LaborDtl"]));
        if (view2.dataView.Count == 1)
	    {
	        //Code to display CommentText
	    }
    }
}

James, what I’m trying to do is show the comment text for the selected job/assembly/operation on the MES main menu.

Do you maybe need to have a duplication of the code so runs on form load, and then runs again when the row changes?

I don’t think it will work on form load, because on form load the employee has not yet clocked in so the DataView is empty.

I stumbled upon this thread, and now it works! I just needed to change the notify type to Initialize instead of AddRow.

So the final solution uses two cases; one to check when the dataview initializes (fires when a user logs in and is already clocked in to a job, and also fires when a user clocks on to a job having no other jobs clocked in), and another to check when a user is going between different clocked in jobs.

Thank you everyone for your help in getting this one resolved!

1 Like