# How to Create a BAQ in Epicor: Build, Run, Search, Export to Excel and Publish

> Source: https://netray.co/erp-help/how-to-create-baq-in-epicor
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: ERP Help

## Short answer

A BAQ (Business Activity Query) is a saved SQL-style query built in Epicor's Query Builder. Open Query Builder, name the query, add tables and join them, choose display fields, add criteria, test it, then run it from the Execute or Analysis tabs, export to Excel, and publish it for use in a dashboard or report.

## Kind

how-to

## System

epicor

## Erp

Epicor Kinetic

## Module

BAQ / Query Builder

## Query

how to create baq in epicor

## Alternate Queries

- how to create a baq in epicor 10
- epicor create baq report
- how to run a baq in epicor
- epicor baq to excel
- epicor baq search
- make baq a dashboard epicor kinetic
- epicor baq table

## Applies To

Epicor Kinetic and 10.x. Tab and menu names are close across releases but may differ slightly.

## Steps

### How to create a BAQ in Epicor

**Items:**

- Search the menu for Query Builder (also under the Business Activity Query / Executive Analysis area).
- Click New, enter a Query ID such as ZOpenOrdersByCustomer and a Description.
- On the Query tab, add the tables you need, for example OrderHed and OrderDtl. Check the Table Relations so the join matches (OrderHed to OrderDtl on Company and OrderNum).
- Open Display Fields, tick the columns you want and set labels. Check any needed aggregate on the Group By tab.
- Open Table Criteria and add filters, for example OpenOrder = true, or a parameter if the user should choose a value.
- Use the Analyze or Test action to check the SQL and the result. Fix any join problems.
- Save, then Publish if the BAQ is to be used in dashboards or with a different company, and give security access.

## Sections

### Choosing tables and joins

**Body:**

Start from the table that is the row you want, not the one that has the most columns. If you report on order lines, start from OrderDtl and join OrderHed for header data. Always join on Company plus the key. A missing Company join is the usual cause of duplicate rows in multi-company databases.

The default join is inner, which drops rows with no match. Change the relation to a left outer join where the second table is optional, for example parts that may have no inventory record. Use the BAQ search or a database diagram to find tables if you do not know the name. Epicor Data Dictionary Viewer helps.

### Running, searching and exporting

**Body:**

Once saved, run the BAQ from the Execute or the Analysis tab in Query Builder. Searches in the grid help for small results. For ad hoc use, open the BAQ in a dashboard or the Business Activity Query menu and filter there. Results export to Excel from the grid with the Export action, or through the Excel integration if it is installed on your system.

Large results are slow in the grid and in Excel. Add criteria first, use Top N for samples, and see the BAQ performance page if the query is slow.

### Publishing as a dashboard or report

**Body:**

To show a BAQ to users, build a dashboard around it in Application Studio or use the dashboard generator available in Query Builder in your release. Add the dashboard to a menu and grant security. See the Epicor dashboard page for the steps.

To print it, create a BAQ report from the BAQ and give it parameters. See the BAQ report parameter page. Test with a normal user account, because BAQ access is controlled by security groups and a developer account can hide permission problems.

## Pitfalls

- Forgetting the Company join and getting duplicate lines in multi-company systems.
- Using an inner join where rows without a match should remain.
- Building one giant BAQ for everything. Smaller BAQs are faster and reusable.
- Testing only as an admin and finding users cannot run it.
- Returning all rows to Excel instead of filtering first.

## Ai Angle

An assistant grounded in the Epicor schema can turn a plain request such as open order lines by customer into a proposed table list, joins and criteria for a developer to check in Query Builder, and can explain an existing BAQ in plain language. It is read-only by default. ERPray works this way over live ERP data.

## Faq

### How do I run a BAQ in Epicor?

**Answer:** Open it in Query Builder and use the Execute or Analysis tab, or open it through a dashboard or a Business Activity Query menu item. Users need security access to the BAQ.

### How do I export a BAQ to Excel?

**Answer:** Run the BAQ and use the grid Export action to Excel. If your site uses the Epicor Excel add-in, you can also pull the BAQ into a sheet. Filter first for large result sets.

### How do I make a BAQ into a dashboard?

**Answer:** Use the dashboard generation action in Query Builder if your release offers it, or build a dashboard in Application Studio bound to the BAQ. Add a menu item and security.

### Why does my BAQ return duplicate rows?

**Answer:** Most often a join is missing Company, or you joined a table that has many rows per key. Check the relations and add the missing key fields.

## Search terms

how to create baq in epicor, epicor baq tutorial, epicor query builder, epicor baq to excel, epicor baq search, epicor baq dashboard, epicor baq table relations, epicor business activity query

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
