12-How To Call An Epicor BAQ Report From Customization - GingerHelp
12-How To Call An Epicor BAQ Report From Customization - GingerHelp
E P I C O R : H OW TO CA L L A
B AQ R E P O RT F R O M W I T H I N
A C U STO M I Z AT I O N
ADAM ELLIS · JUNE 18, 2020
We have already documented how you can call a BAQ from within a
customization on this article but what if you want to run a BAQ Report?
While there is more than one way, I find the most efficient methodology is
to simply launch the BAQ Report dialog, auto-populate the fields to run
the report, and execute the event to either print or preview the report.
And we can do that without the user having any clue to the complexity
behind the scenes by using scenario #3 from this guide. If you follow that
guide and reference Ice.UIRpt.BAQReport then you can use a code
snippet like this to easily print or preview any BAQ Report that you like:
https://www.gingerhelp.com/knowledgebase-epicor-erp/epicor-how-to-call-a-baq-report-from-within-a-customization 1/13
5/16/24, 3:46 PM How to Call an Epicor BAQ Report From Customization — GingerHelp
https://www.gingerhelp.com/knowledgebase-epicor-erp/epicor-how-to-call-a-baq-report-from-within-a-customization 2/13
5/16/24, 3:46 PM How to Call an Epicor BAQ Report From Customization — GingerHelp
edvData.dataView[edvData.Row]["field1"] = "PART123";
I realize this is an old post but I hope you will be able to answer my question. How
would I specify to print to the client printer instead of the server printer? If I put in
"Print" it defaults to the server printer. I have not been able to find anything that tells
me how to print to the client printer.
We have a grid to select the records that need to be printed through a BAQ report.
We need each line selected printed, but we would like to combine all the records
together and send as on print batch job.
https://www.gingerhelp.com/knowledgebase-epicor-erp/epicor-how-to-call-a-baq-report-from-within-a-customization 3/13
5/16/24, 3:46 PM How to Call an Epicor BAQ Report From Customization — GingerHelp
How do you pick the number of copies you want printed of each record?
Dan,
A BAQ that uses 'Filters' is a bit more challenging than one that uses 'Options' to input
the parameters to run the report. Quick thought - what if you just made a second BAQ
Report definition that only uses an option field to input the case number? You could
still point to the same RDL and BAQ, the only difference would be on this version you
have a plain text box to input the case number as opposed to the nice lookup view.
And you wouldn't even need to put it on the menu anywhere.
If you do want to keep plugging away at the path of getting the filter list input working
it is definitely possible - I've done it before but could not track down a nice snippet for
you. In short, that Filter1 object needs to get populated with a DynamicReportDataSet
object for it to run.
Thanks, Adam. I did end up going down the path of using an option instead of
a filter. That worked well.
Adam,
Thanks for posting this for all to see. I am trying this out with a BAQ Report and I feel
I'm 97% of the way there. I can get the form to pop-up a PDF when I click a button -
but it's not passing the filter. I did the Field Help and it says the field is named
FilterList1. It's not getting to the BAQ Report, though. It ends up printing HDCaseNum =
1 instead of the number I pass along. Is there an obvious thing I'm missing, here?
https://www.gingerhelp.com/knowledgebase-epicor-erp/epicor-how-to-call-a-baq-report-from-within-a-customization 4/13
5/16/24, 3:46 PM How to Call an Epicor BAQ Report From Customization — GingerHelp
Yeah, it has been a while but I know exactly what you are trying to accomplish. The
last time I did it were were unable to customize the Crystal Reports viewer that Epicor
has in place by default but we were able to add our own Crystal Reports Viewer
control to the Epicor form and bind that ReportDocument to is in order to see the
results. I wish I still had the snippet - I feel like you are like 98% of the way there.
Unfortunately, this is not quite what I am looking for. The PrintDialog was useful
portion.
https://www.gingerhelp.com/knowledgebase-epicor-erp/epicor-how-to-call-a-baq-report-from-within-a-customization 5/13
5/16/24, 3:46 PM How to Call an Epicor BAQ Report From Customization — GingerHelp
The best way to explain what I am looking for is to refer to a Dashboard. Some
dashboards allow you to print a Report via the 'Actions' menu. Once clicked it opens a
'Preview Window'
I believe this Preview Window is different depending on if you are using SSRS or
Crystal Report. For the Crystal Report one (which we are using) the popup window
shows the report results with "SAP CRYSTAL REPORT" written at the top-right of the
window.
Again - thank you for helping. Your posts have been very interesting and will be
visiting more.
I will see what I can get out of this. If I get it to work I will post back the code if any
different.
Martyn,
I think I've got a snippet here that is actually pretty similar to what you're looking to
do. It has been a while since I last used this but hopefully it points you in the right
direction:
https://www.gingerhelp.com/knowledgebase-epicor-erp/epicor-how-to-call-a-baq-report-from-within-a-customization 6/13
5/16/24, 3:46 PM How to Call an Epicor BAQ Report From Customization — GingerHelp
====
This snippet of code shows how to use reflection to access the functionality of the
Crystal Reports runtime without explicitly defining a reference to the DLLs. This
specific example would be most useful in something like Epicor where you want to
leverage the runtime assemblies without requiring end users copy DLL files into their
Epicor client folder. The overall technique here, though, would be useful for any .Net
assembly that is registered in the global assembly cache.
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Epicor.Mfg.BO;
using Epicor.Mfg.UI;
using Epicor.Mfg.UI.Adapters;
using Epicor.Mfg.UI.Customization;
using Epicor.Mfg.UI.ExtendedProps;
using Epicor.Mfg.UI.FormFunctions;
using Epicor.Mfg.UI.FrameWork;
using Epicor.Mfg.UI.Searches;
using System.Runtime.InteropServices;
using System.Drawing.Printing;
using System.Drawing;
using System.Reflection;
https://www.gingerhelp.com/knowledgebase-epicor-erp/epicor-how-to-call-a-baq-report-from-within-a-customization 7/13
5/16/24, 3:46 PM How to Call an Epicor BAQ Report From Customization — GingerHelp
Epicor.Mfg.BO.DynamicQuery dy;
Epicor.Mfg.BO.QueryDesignDataSet data;
DataSet baqResult;
bool recSelected = false;
string whereClause = "";
try {
dy = new Epicor.Mfg.BO.DynamicQuery(((Epicor.Mfg.Core.Session
https://www.gingerhelp.com/knowledgebase-epicor-erp/epicor-how-to-call-a-baq-report-from-within-a-customization 9/13
5/16/24, 3:46 PM How to Call an Epicor BAQ Report From Customization — GingerHelp
https://www.gingerhelp.com/knowledgebase-epicor-erp/epicor-how-to-call-a-baq-report-from-within-a-customization 10/13
5/16/24, 3:46 PM How to Call an Epicor BAQ Report From Customization — GingerHelp
Hi. Thanks for this. One question... I have created a Customization (rather than a
dashboard due to the filtering options) and would like to generate a crystal report
based on the results in the UltraGrid. I am using the Crystal Reports
CrystalDescisions/ReportDocument to create it and send it to OneNote.
However, I would love to be able to send it straight to the Preview Window in Epicor
like the Reports open in a Dashboard. I believe the trans.RunDirect("Preview") is
exactly that!
Can I bypass loading the information from a BAQReport and, instead, be able to use
the name (and location) of the report and results in UltraGrid straight into the
Previewer?
PREVIOUS
NEXT
https://www.gingerhelp.com/knowledgebase-epicor-erp/epicor-how-to-call-a-baq-report-from-within-a-customization 11/13
5/16/24, 3:46 PM How to Call an Epicor BAQ Report From Customization — GingerHelp
LET’S CHAT!
CONTACT US
https://www.gingerhelp.com/knowledgebase-epicor-erp/epicor-how-to-call-a-baq-report-from-within-a-customization 12/13
5/16/24, 3:46 PM How to Call an Epicor BAQ Report From Customization — GingerHelp
GingerHelp is an
independent consulting
practice with no direct
© 2019 - 2023 GingerHelp,
affiliation with Epicor® or
LLC
Infor®.
https://www.gingerhelp.com/knowledgebase-epicor-erp/epicor-how-to-call-a-baq-report-from-within-a-customization 13/13