Pass parameters to SSRS report form

Goal: Generate a PDF on button click on a custom form.
So far:
Created a BAQ with 2 parameters
Created Report Data Definition based on BAQ and created report criteria set
Created Report Style that uses Report DD
Created SSRS RDD for Report Style
Formatted SSRS RDD and published.
Added report to Menu - Tested work as I would hope.
Added Button to form.
Added code ProcessCaller.LaunchForm(oTrans, “52”); to button_click

Result:
Report Form comes up I type in parameter values, prints report – All good.

Now I would like to pass the parameters to the form so customer doesn’t have to fill them in and if I am able to do that next would be to just submit the report automatically.

I cannot figure out how to pass parameters to the print form in code. I have tried passing a LaunchFormOptions variable but the form looks totally different so I am sure I am doing something wrong.

Any help would be greatly appreciated. Thanks

Have you already seen this thread?

I would offer that you have the user enter the parameters in the first form and send those using the LaunchFormOptions (as @bordway states) to the Report Form. Howeever, if that is not possible, then it can be done the way you suggest.

Is this button on the BAQ Report Form, or another form? And where are the parameters that you want to auto-populate your BAQ Report form coming from?

The button is on a new sheet in the Opportunity/Quote Entry screen. It’s highly customized worksheet for our sales group. There is no “BAQ Report” in the solution. In quotes because I am not sure how you mean it. I never used the “BAQ Report Designer”. I created a Report Style that uses a Report DD that uses my BAQ as the source.

I have the parameters I want to pass in the calling form. Just don’t how to send them to called form and have it apply them.

Thanks for your help…

Thinks for the link. One quick issue is the print form I am using is a Base Extension so I don’t have permission to save it.

I already have the parameter values I want to pass. Just can’t figure out how to pass them.

Thanks

I’m not sure I’m following…I don’t think the way you made the report should make a difference?
Where I’m assuming the menu ID item for the report is calling a report style?
and then your button on the main form is using LFO to call that menu ID (and pass any parameters needed via the LFO), which in turn launches the report form (and customize to handle any parameters being passed?

The only correction to your statement is the button is not using a LFO. It simple one line:
ProcessCaller.LaunchForm(oTrans, “52”);

When I try and use LFO to pass values a different form appears with all options greyed out

Hmmm…not sure what that “52” means.
Maybe you can send screenshot(s), help us better understand what is going on?

Struggle to be succinct but not clutter with info.
Here is the menu entry
image

Here is the calling form Button:

Here is the form(Menu ID 52) that appear

If I put in the quote and line#'s the report will run as I hope. I am trying to pre populate those parameters. I already have the values I want to pass in the calling form.

When I said “BAQ Report”, I meant “BAQ based RDD report”. The report form that uses your RDD, which uses a BAQ.

Sorry menu screen shot is too small to read.

Aft first glance…
I don’t see a customization specified for the menu ID (52)
That customization is where I would normally add the LFO handling.

Attached word doc is just a copy of the thread I referenced in the beginning/
See if that is easier to follow/helps - and let me know if not I might have time to add screenshots to it later.
LFO Basics.doc (38.5 KB)
I know… LFO is not intuitive, once you get it though, works well.

I was trying to customize the form after being called from the button and I didn’t have permissions. Finally realized my mistake and customized the form after starting it right from the menu. Now I am able to add the code from the document/link shared and I am good to go. Thanks to all who took the time to help me. Happy new year!

Hi! I have exactly similar case here. Managed to do this in baq report previously but in this rdd report I get error setting parameter (option).

How did you set values to QuoteNumber and LineNumber? When I try to set those in DynamicCriteriaReportForm_Load getting values from LaunchFormOptions I’ll get error that control (sid number) does not exist using command below

var txtItem = (Ice.Lib.Framework.EpiTextBox)csm.GetNativeControlReference(“c33b3dbb-dd86-47ec-a0dc-b07d2fa5caab”);

The GUID (the “c33b3dbb-dd86-47ec-a0dc-b07d2fa5caab” part) is unique to your system. You need to find that control’s GUID, and adjust the code to use it. In customization mode, click on the control whose GUID you need to know, then in the developer window, go to the properties tab and the GUID will be listed.

WARNING I am a hacker. Do what I do at your own risk.
I found this video invaluable in setting up my SSRS report from my BAQ’s. Multiple BAQs for Custom Reports in Epicor | EpiCenter (epicentererp.com)

On the button click action on my form I added code to gather the two values I wanted to pass to the SSRS report critera. And called the menu item for the SSRS passing the quote and line#
private void prtOpersButton_Click(object sender, System.EventArgs args)
{
EpiTextBox QuotNum = (EpiTextBox)csm.GetNativeControlReference(“8e25166f-6185-4497-b3d6-1798e4e9c4a0”);
EpiUltraComboPlus LineNum = (EpiUltraComboPlus)csm.GetNativeControlReference(“fa359824-fd06-42b4-9f2c-e31d23d4f97e”);
string currentQtNum=QuotNum.Text;
string currentLineNum=LineNum.EpiCombo.Text;

string[] prtParams = {currentQtNum, currentLineNum };

LaunchFormOptions lfo = new LaunchFormOptions();
lfo.IsModal = true;
lfo.ContextValue=currentQtNum +“,”+currentLineNum; // Make string values delimited
ProcessCaller.LaunchForm(oTrans, “52”,lfo); //52 is the menu id
}

Then on the Load Form event I loaded the quote/line # to the report critera and printed:
private void DynamicCriteriaReportForm_Load(object sender, EventArgs args)
{
if (DynamicCriteriaReportForm.LaunchFormOptions != null && DynamicCriteriaReportForm.LaunchFormOptions.Sender != null)
{

			  EpiTextBox quoteTextBox = (EpiTextBox)csm.GetNativeControlReference("eb773ce2-4fac-451c-8372-3d4bcf9aaf26");			  				
			  EpiTextBox lineTextBox = (EpiTextBox)csm.GetNativeControlReference("b2c4a559-f002-450e-9d3a-3404b2fa9a26");

  		    object ctxValue = DynamicCriteriaReportForm.LaunchFormOptions.ContextValue;
			  string[] values = ctxValue.ToString().Split(','); // Split string
	EpiDataView dvRP = (EpiDataView)oTrans.EpiDataViews["ReportCriteria"];
	string workID = oTrans.WorkStationID.ToString();

			dvRP.dataView[dvRP.Row]["Quote_1"] = values[0];
			dvRP.dataView[dvRP.Row]["Line_2"] = values[1];
			 quoteTextBox.Text = values[0];
			 lineTextBox.Text = values[1];	
			quoteTextBox.ReadOnly=true;
			lineTextBox.ReadOnly=true;			

		oTrans.PushDisposableStatusText("Reports Submitted for Preview...", true);
		}
	
}

Hope this some value to you.

Thank’s for your answer. That is exactly what I’m doing in my code. It would be similar if you would get error setting
" EpiTextBox quoteTextBox = (EpiTextBox)csm.GetNativeControlReference(“eb773ce2-4fac-451c-8372-3d4bcf9aaf26”); "

I must have a sid mismatch between customation form display and actual sid somewhere in system.

Found my old question and answering it now.

Set values to ReportCriteria:
declare view and edit it. EpiDataView edv = (EpiDataView)oTrans.EpiDataViews[“ReportCriteria”];
edv.Row=0;
edv.dataView[edv.Row].BeginEdit();
edv.dataView[edv.Row][“AssemblySeq_1”] = yourVar1;
edv.dataView[edv.Row][“JobNum_2”] = yourVar2;
edv.dataView[edv.Row].EndEdit();

Set values to ReportParam:
EpiDataView edvStyle = (EpiDataView)oTrans.EpiDataViews[“ReportParam”];
edvStyle.Row=0;
edvStyle.dataView[edvStyle.Row].BeginEdit();
edvStyle.dataView[edvStyle.Row][“ReportStyleNum”] = yourNum;
edvStyle.dataView[edvStyle.Row].EndEdit();

Find field names with data tools.