I have a C# code printing a BAQ report. The report is coming out blank. I would like to know how to print the last record added in my UDtables on the BAQ report.
Here is the code.
string agentID = "";
try
{
Session otSession = (Session)oTrans.Session;
//Set the workstationID
string workStation = Ice.Lib.Report.EpiReportFunctions.GetWorkStationID(otSession);
// Get or Set the AgentID
using (var aSA = new SysAgentAdapter(oTrans))
{
oTrans.PushStatusText("Get System Agent Info", true);
aSA.BOConnect();
aSA.GetDefaultTaskAgentID(out agentID);
if (!string.IsNullOrEmpty(agentID))
{
agentID = "SystemTaskAgent";
}
}
//MessageBox.Show(agentID + ", " + workStation);
{
var baqR = WCFServiceSupport.CreateImpl<Ice.Proxy.Rpt.BAQReportImpl> ((Session)oTrans.Session, Epicor.ServiceModel.Channels.ImplBase<Ice.Contracts.BAQReportSvcContract>.UriPath);
var dynamicReport = WCFServiceSupport.CreateImpl<Ice.Proxy.BO.DynamicReportImpl>((Session)oTrans.Session, Epicor.ServiceModel.Channels.ImplBase<Ice.Contracts.DynamicReportSvcContract>.UriPath);
var rptMonitor = WCFServiceSupport.CreateImpl<Ice.Proxy.BO.ReportMonitorImpl>((Session)oTrans.Session, Epicor.ServiceModel.Channels.ImplBase<Ice.Contracts.ReportMonitorSvcContract>.UriPath);
//GET DEFAULT REPORT PARAMETERS
var rptDs =dynamicReport.GetByID("EtiquetteSecond");
var baqRptDS = baqR.GetNewBAQReportParam("EtiquetteSecond");
//baqRptDS.BAQReportParam[0].Option01 = guid.ToString();
baqRptDS.BAQReportParam[0].AutoAction="SSRSPREVIEW";
baqRptDS.BAQReportParam[0].WorkstationID=workStation;
baqRptDS.BAQReportParam[0].SSRSRenderFormat = "PDF";
baqRptDS.BAQReportParam[0].Character01="PrintPrev";
//baqRptDS.BAQReportParam[0].Character02=flag;
baqRptDS.BAQReportParam[0].BAQRptID="EtiquetteSecond";
baqRptDS.BAQReportParam[0].ReportID="EtiquetteSecond";
baqRptDS.BAQReportParam[0].Summary = false;
baqRptDS.BAQReportParam[0].ReportStyleNum = 1;
baqRptDS.BAQReportParam[0].BAQID="PanneauSec";
baqRptDS.BAQReportParam[0].ReportTitle = "e";
//baqRptDS.BAQReportParam[0].TaskNote = guid.ToString();
//rptDs.BAQRptOptionFld[0].FieldValue = "Key2" ;
rptDs.AcceptChanges();
StringWriter writer = new StringWriter();
rptDs.WriteXml(writer);
baqRptDS.BAQReportParam[0].Filter1 = writer.ToString ();
//baqR.RunDirect(baqRptDS);
baqR.SubmitToAgent(baqRptDS, agentID, 0, 0, "Epicor.Mfg.UIRpt.BAQReport");
MessageBox.Show("Impression demandé");
}
oTrans.Update();
oTrans.Refresh();
}
catch (Exception ex)
{
MessageBox.Show("Erreur d'impression" + ex.Message);
}