Passing Field Values to BAQ Report Options

I’ve been digging around and can’t figure it out, so I’m crying for help… again lol.

I created a button, on the job adjustment screen, that calls a baq report form. I’d like to pass the Job Number and the selected Assembly/Operation numbers from the customized Job Adjustment screen (Laser Op List) to the Option fields on my BAQ Report (Part Tags) form.

Here’s the code I’m using on the Job Adjustment Button

	public void btnmtl_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
	
		LaunchFormOptions lfo = new LaunchFormOptions();
		lfo.IsModal = true;
		System.Collections.Generic.Dictionary<string, string> mylist = new System.Collections.Generic.Dictionary<string, string>();
		mylist.Add("JobNum", tbJobNum.ToString());
		mylist.Add("Asm", cboAsmSeq.ToString());
		mylist.Add("OprSeq", cboOper.ToString());
		lfo.ContextValue = mylist;
		ProcessCaller.LaunchForm(oTrans, "UDPARTAG", lfo);

	}

I don’t have any code on the BAQ report that opens. This is where I’m getting lost.

How would I put the values from mylist into the text box option fields on the baq report screen?

image

All I need to pass is the Job Number, Assembly Sequence and the Operation Sequence to the corresponding controls\fields. Not sure if the code on my button is correct either. Any help is appreciated.

Do some searching on this site for LaunchFormOptions. You’ll find some good example code for the BAQ Report screen.
Here is just one:

2 Likes

I actually managed to figure it out yesterday, using LaunchFormOptions on the button that opens the receiving form. I was having issues splitting my substring on the receiving form but it’s all working now. I still can’t get it work on a form load event though, I have to use a button on receiving form.

Code from Job Adjustment (sending form)

	public void btnmtl_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
	

		
		LaunchFormOptions lfo = new LaunchFormOptions();
		lfo.IsModal = false;
		lfo.ValueIn = (tbJobNum.Text + "~" + cboAsmSeq.Value + "~" + cboOper.Value);
		ProcessCaller.LaunchForm(oTrans, "UDPARTAG", lfo);

	}

BAQ Report (Receiving form)

	public void btnjob_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **


				if(BAQReportForm.LaunchFormOptions != null)
		{
			string val = BAQReportForm.LaunchFormOptions.ValueIn.ToString();

			string[] items = val.Split('~');
			
			string job = items[0];
			string asm = items[1];
			string opr = items[2];

			EpiDataView view = ((EpiDataView)(this.oTrans.EpiDataViews["ReportParam"]));

			view.dataView[view.Row].BeginEdit();
			view.dataView[view.Row]["field1"]= job;
			view.dataView[view.Row].EndEdit();

			view.dataView[view.Row].BeginEdit();
			view.dataView[view.Row]["field2"]= Convert.ToInt32(asm);
			view.dataView[view.Row].EndEdit();

			view.dataView[view.Row].BeginEdit();
			view.dataView[view.Row]["field3"]= Convert.ToInt32(opr);
			view.dataView[view.Row].EndEdit();
			
			oTrans.Update();
		
			txtfield1.Text = job;
			numfield2.Value = Convert.ToInt32(asm);
			numfield3.Value = Convert.ToInt32(opr);


		}	
		else
		{
		}

	}

I appreciate the help though!

1 Like