I am trying to, from a button, launch a report with criteria selected from the report. I am hitting a wall. Most documentation I find is for a BAQ report. I created this report using RDD and it runs with SSRS Breaking/Routing rules. I tried to follow this post, but it doesn’t work anymore. C# Help with DynamicCriteria Report
Any nudge in the right direction is appreciated. Currently I have the code launching a BAQ, which does half of what I want, but I need to get the report to trigger.
If you can find an existing menu location for the report you’re trying to launch, you can do it by Launching the Form through the button click. Here is an example of where I use an Actions menu click to launch the BOM Listing report from Method Tracker using the parameters of the revision I have loaded in Method Tracker. I imagine you could do something similar.
private void BOMListing_ToolClick(object sender,Infragistics.Win.UltraWinToolbars.ToolClickEventArgs args)
string partNum = this.edvECORev.dataView[this.edvECORev.Row]["PartNum"].ToString();
string revision = this.edvECORev.dataView[this.edvECORev.Row]["RevisionNum"].ToString();
if (!String.IsNullOrEmpty(partNum) && !String.IsNullOrEmpty(revision))
LaunchFormOptions lfo = new LaunchFormOptions();
lfo.IsModal = true;
lfo.ValueIn = partNum + "~" + revision;
ProcessCaller.LaunchForm(oTrans, "SEMN4020", lfo);
string NoPartMessage = "No part number and/or revision available.";
string NoPartCaption = "BOM Listing Not Available";
MessageBox.Show(NoPartMessage, NoPartCaption, MessageBoxButtons.OK);
Ok this may work. I am looking for a way to run this without further user interaction. Will this allow me to launch the form and submit the report without the user being able to stop the process? If not, I’ll work with it. I have a similar button in quotes that populates the variables and allows the user to run a report, but for this one, I was hoping to have the button be the last interaction from the user.
You should be able to do this… but what I pasted up there will still require the user to click the print preview to get the form. Depending on the form, you might be able to pass some parameters using the launch form options telling it to RunDirect or something like that… and if that doesn’t work, you can customize the print dialog to tell it to print and then close the screen without a user interaction. I have used both ways and I don’t remember why one way had to be used vs. the other.
Perfect, I’ll give this a shot and post the final solution when I get it sorted. Thank you.
I ended up having the form close itself after ‘printing’. It works. It does ask if you want to run the break/routing rules, but I can live with that.
private void DynamicCriteriaReportForm_Load(object sender, EventArgs args)
// Add Event Handler Code
if (DynamicCriteriaReportForm.LaunchFormOptions != null && DynamicCriteriaReportForm.LaunchFormOptions.Sender != null)
EpiNumericEditor numOrderNum_1 = (EpiNumericEditor)csm.GetNativeControlReference("78f1864b-7dc8-4145-931d-c1d6a2b10bdd");
object ctxValue = DynamicCriteriaReportForm.LaunchFormOptions.ContextValue;
string values = ctxValue.ToString().Split(','); // Split string
EpiDataView dvRP = (EpiDataView)oTrans.EpiDataViews["ReportCriteria"];
string workID = oTrans.WorkStationID.ToString();
EpiDataView ds = (EpiDataView)(oTrans.EpiDataViews["ReportParam"]);
var EnableRouting = ds.dataView[ds.Row]["SSRSEnableRouting"];
var AutoAction = ds.dataView[ds.Row]["AutoAction"];
var RSN = ds.dataView[ds.Row]["ReportStyleNum"];
EnableRouting = true;
AutoAction = "SSRSPREVIEW";
RSN = 1001;
dvRP.dataView[dvRP.Row]["OrderNum_1"] = int.Parse(values);
numOrderNum_1.Value = int.Parse(values);
oTrans.PushDisposableStatusText("Reports Submitted for Preview...", true);