MES Customization Help

Guys i am working on a customization in the MES on the print tag menu and when i use assembly 0 the code work great but when i use assembly greater than 0 the totalqty is 0 can you guys help? the code is below

private void MtlTagsForm_Load(object sender, EventArgs args)
	{
		// Add Event Handler Code
		EpiDataView report = (EpiDataView)(oTrans.EpiDataViews["ReportParam"]);
	
		if(MtlTagsForm.LaunchFormOptions != null)
		{
			string x = MtlTagsForm.LaunchFormOptions.ContextValue.ToString();
			char[] splitchar = { '~' };
			string[] strArr = null;
			strArr = x.Split(splitchar);
			copies.Value = 1;
			for (int count = 0; count <= strArr.Length; count++) 
			{ 
				if(count == 0)
					report.dataView[report.Row]["JobNum"] = strArr[count].ToString();
				if(count == 1)
					report.dataView[report.Row]["AssemblySeq"] = Convert.ToInt32(strArr[count]);
				if(count == 2)
					report.dataView[report.Row]["OprSeq"] = Convert.ToInt32(strArr[count]);
				if(count == 3)
					report.dataView[report.Row]["TotalQty"] = Convert.ToInt32(strArr[count]);
					
			}
			//report.dataView[report.Row]["QtyPer"]= copies.Value;
			
		}

I’d start by verifying that ContextValue (as a whole) looks legit either with debugger or msgbox. Next I’d verify the job-asm-op combination is legit - E10 may be checking that. Other than that, the code looks fine.

I check it with textbox when i print before the for loop the data is good and for the if conditions in the loop option 0,1,2 works fine option 3 is the problem everything else is working great

But didnt you say that option 3 works if you have ASM = 0?

maybe try this to verify whats actually in the array after the split:

foreach(string s in strArr)
{
  MessageBox.Show(s);
}

Why not just pass ValueIn your list (or array if you choose) of strings and save the splitting part?

It is an object right?

Better yet create your own class and use in both sender and reciever

class MyParams
{
string job;
int asm;
int opr;
decimal qty;
}

var p = new MyParams();
p.job = "blah";
p.asm = 1;
etc

//in sender do
ContextValue = p;


//then in receiver do:
var p = (MyClass)MtlTagsForm.LaunchFormOptions.ContextValue;
p.Job... etc

Which makes me wonder…is qty actually an int, or is it a decimal?

This field will only have a value once a quantity has been reported and then it stays for the remainder of that active session. Did you possibly not report any quantity and thus it would be zero until you entered a quantity which would be after form load, at least the first time.