I am on Epicor Kinetic 2024.1.12 and I am trying to develop an Epicor function that runs a BAQ report and downloads the output to a folder. I am able to do that successfully on BAQ reports that don’t have any Filters or Options. Could someone point me in the right direction to help me pass values to the Option fields?
Invoke BO method (Ice.BAQReport.GetNewParametersForReportId) and pass the request parameter ReportID. The output is stored in the response parameter BAQReportParamOutput
Set argument/variable CurrentGUID = System.Guid.NewGuid()
Assign values to the following properties of the added row in the BAQReportParamOutput.BAQReportParam table - BAQID, ReportID, BAQRptID, AutoAction, WorkstationID, AgentSchedNum, AgentTaskNum, SSRSRenderFormat, TaskNote (set to CurrentGUID)
Invoke BO method (Ice.BAQReport.RunDirect) by passing the modified dataset BAQReportParamOutput from step 3
Get the SysTaskNum from the SysTask table where TaskNote = CurrentGUID and use it to get the SysRowID of the corresponding record from the SysRptLst table
Invoke BO Method (Ice.ReportMonitor.GetReportBytes) by passing the SysRowID obtained in step 5. This will return a byte array of the generated PDF
Invoke BO method (Ice.FileTransfer.UploadFile) by passing the byte array from step 6 to generate and export the PDF to the specified folder. In my case, I am using ‘Epicor.ServiceModel.Utilities.SpecialFolder.UserData’
The report that I am trying to make this work with has an Option field ‘Option01’. I tried assigning the value to BAQReportParamOutput.BAQReportParam.Option01, and also passed the xml to BAQReportParamOutput.BAQReportParam.Filter1 that I retrieved from Epicor’s trace log after manually running that BAQ report.
I am not sure what is missing in this design, but Epicor simply runs the BAQ report by ignoring the Option01 value and runs the whole BAQ instead. I would appreciate it if someone could point me in the right direction.
Here’s a custom code one I have working that generates a BAQ report that is formatted for Serial Number labels. The filter1 field xml is kind of critical. You need that XML and you need the Option1 value in it. If you’re trying to make it dynamic to do different BAQ Reports, you’ll probably have to do some editing of the filter1 parameter variable.
As you can see, that string for filter1 has the ReportID, Report Description, BAQID, and others built in. You can see near the end where I added the {SerialNo} variable to the element in the XML string. The Guid and SysRevID don’t seem to be affected by being hardcoded.
I was converting the DynamicReportDataset output to System.Data.DataSet using Ice.DatasetAdapter.ConvertToGenericDataset() and then using the WriteXml() method to get the xml for the ‘Filter1’ field. Because of that, the root element I got was ‘NewDataSet’.
When I replaced my root element with the root element in your code, the BAQ report filtered the data and provided the expected output. Thank you again for your help.