Launching BAQ Report from Button_Click in MES - LFO instructions?

I designed an SSRS BAQ report and added a button to the end activity screen to launch it:

private void epiButtonC1_Click(object sender, System.EventArgs args)
{
	// ** Place Event Handling Code Here **
ProcessCaller.LaunchForm(oTrans, "UDJbTags");
}

This launches the report print window just fine, but now I want it to pre-populate the BAQ report option fields with the Job Number and Assembly Sequence from the End Activity screen. I’ve done a ton of digging on this site to try and understand how to accomplish this (much of it is above my coding abilities :slight_smile: ).

It sounds like I need to use custom code/LFO to push data out of the end activity screen, then customize the BAQ report to receive/populate the option fields. Am I on the right track here? Can someone spell out how I would code this?

(As I side note - I first tried to do this with a BAQ-based RDD/Report Style SSRS report and kept getting an error that the menu ID is not valid from the MES menu. Is it not possible to launch reports from an MES button? As soon as I pivoted to a standard BAQ report/SSRS it launched from the button without issue.)

Thank you!!

If anyone is curious… here is the code I ended up using:

This is the code on the MES End activity screen

private void epiButtonC1_Click(object sender, System.EventArgs args)
{
EpiDataView _edvEnd = ((EpiDataView)(this.oTrans.EpiDataViews[“End”]));

	LaunchFormOptions lfo = new LaunchFormOptions();
	lfo.IsModal = true; // true will basically not allow the user to do anything on Form1 until Form2 is closed.
	string MyJobNum = _edvEnd.dataView[_edvEnd.Row]["JobNum"].ToString();
	string MyAssemblySeq = _edvEnd.dataView[_edvEnd.Row]["AssemblySeq"].ToString();
	lfo.ValueIn = MyJobNum + ',' + MyAssemblySeq;
	ProcessCaller.LaunchForm(oTrans, "UDJbTags", lfo);

}

This is the code on the BAQ Report launched form:

private void BAQReportForm_Load(object sender, EventArgs args)
{
if (BAQReportForm.LaunchFormOptions != null && BAQReportForm.LaunchFormOptions.Sender != null && BAQReportForm.LaunchFormOptions.ValueIn != null)
{

	string lfoValue = BAQReportForm.LaunchFormOptions.ValueIn.ToString();
	string lfoSenderName = BAQReportForm.LaunchFormOptions.Sender.ToString();

	string[] MyParams = lfoValue.Split(',');

	EpiDataView _edvReportParam = ((EpiDataView)(this.oTrans.EpiDataViews["ReportParam"]));
	_edvReportParam.dataView[_edvReportParam.Row]["field1"] = MyParams[0];
	_edvReportParam.dataView[_edvReportParam.Row]["field2"] = MyParams[1];
}

}