BAQ reports
When no standard report has the data you need, the quickest route to a printable, properly formatted document is usually a BAQ. You write the query in the BAQ Designer (where joins and calculated fields are easy to test), and SSRS only has to lay the results out. Epicor gives you two ways to do it.
Two ways to build one
Section titled “Two ways to build one”| BAQ Report Designer | RDD with BAQ data sources | |
|---|---|---|
| Where you set it up | BAQ Report Designer | Report Data Definition plus Report Style Maintenance |
| Number of BAQs | One | One or more, with relationships between them |
| Report options | Option fields and filters you add in the designer | Report criteria sets on the RDD |
| Starting RDL | Created for you when you save | Created with Actions > Create SSRS Report on the style, then Sync Dataset |
| Can also include Epicor report tables | No | Yes |
| Menu program type | BAQ Report | Report |
Pick BAQ Report Designer for a simple list report from one query. Pick an RDD when you need a header/detail layout from several queries (for example invoice headers and invoice lines), extra parameters, or data from Epicor’s own report tables next to your BAQ.
Naming
Section titled “Naming”- Give the Report ID your prefix and use underscores between words:
XX_OpenCredits. - Never put a slash in a Report ID. Epicor builds the report’s file path from the ID, so a slash sends it looking in a folder that doesn’t exist and the report won’t load from its menu item. Epicor doesn’t warn you when you save one.
BAQ Report Designer
Section titled “BAQ Report Designer”- Build and test the BAQ first.
- In BAQ Report Designer, create a new report definition: enter the Report ID, a
Description, the BAQ ID and a Form Title. Save. Epicor creates a blank RDL with its data
source and a
BAQReportResultdataset already set up. - Add option fields for values the user should choose on the report form (for example a check box bound to a BAQ column with an Equals operator), and filters for lists the user can pick from.
- Download the RDL from Report Style Maintenance (use the BAQ report’s ID), lay out the
BAQReportResultfields in Report Builder, and upload it again. - Test with Actions > Test Report Form in BAQ Report Designer.
- Add a menu item in Menu Maintenance with Program Type set to BAQ Report.
RDD with BAQs
Section titled “RDD with BAQs”- Build each BAQ. Give the header query its parameters (for example a supplier and a date), and let detail queries be filtered by their relationship to the header instead of by parameters.
- In Report Data Definition, create a new definition, add the BAQs as data sources, and define relationships between their columns (always including company).
- Create Report Criteria Sets for the prompts the user fills in.
- In Report Style Maintenance, create a report and a new style: Report Type SQL Server Reporting, Output Location Database, your RDD, and your criteria set.
- Choose Actions > Create SSRS Report, then Sync Dataset. Without the sync, the BAQ datasets aren’t added to the RDL.
- Download, lay out, upload, and add a menu item with Program Type set to Report.
Getting report options into the layout
Section titled “Getting report options into the layout”The user’s choices on the report form (dates, check boxes) are saved with the run, but they aren’t in
the BAQReportResult dataset. That matters when you want to print “Credits from 1 January to
31 March” in the heading, or use the date in a calculation.
In a BAQ report, the option values are extracted into a parameter table, BAQReportParameter, with one
row per run. Because it has only one row, you can cross join it onto the results:
-
Add the option field in BAQ Report Designer (for example a date option).
-
Download the RDL and open the
BAQReportResultdataset’s query expression. -
Cross join the parameter table and select the option column (
Date01in this example; check which column holds your option):="SELECT R.*, P.Date01 AS OptionFromDateFROM dbo.[BAQReportResult_" + Parameters!TableGuid.Value + "] AS RCROSS JOIN dbo.[BAQReportParameter_" + Parameters!TableGuid.Value + "] AS P" -
Add
OptionFromDateto the dataset’s Fields, then use it in text boxes or calculated fields. -
Upload the RDL.
Current week, month or year
Section titled “Current week, month or year”A common request is one report with sections for “this week”, “this month” and “this year”. Rather than
asking users for dates, filter each table (tablix) in the layout with date functions in the report’s
custom code, for example a filter on Fields!InvoiceDate.Value between =Code.StartOfMonth(Today())
and =Code.EndOfMonth(Today()). The functions are on
SSRS expressions and custom code.
Related
Section titled “Related”- Build a dashboard step by step if the users want to view the data on screen rather than print it
- Troubleshooting for BAQ report creation errors
Sources
This page is written in our own words. It was informed by: