BAQ Where Claused With parameter

I am creating a BAQ and using 2 parameters. When I put in the Transfer Order and Packnum, it is showing all the PackNums within that Transfer Order.

When I do it via SQL like the first screenshot, it works fine. Any ideas how I can accomplish the same with BAQ?


This is what my BAQ looks like. I want to allow the user to be able to input the Transfer Order Number and PackNum together, or just one or the other. If they input only the Transfer Order Number, then bring all the packnum. If they just want to input the packnum, it would only bring that. However, I have some users wanting to put both and then it brings all the packnum and should only be bringing in just the one packnum.

Take a look at the query phrase of the BAQ.

What does that say. You query looks a bit different to me.


Your SQL has 4 conditions, while your BAQ only has 2.

Yeah, I am trying to get to the 4 conditions similar to my sql statement, but doesn’t seem like it’s possible. I know that when I define the parameters, I can have it skip the condition if it is empty. However, if I input both the Transfer Order Number and PackNum, it still pull all the packnums related to that transfer order and not just the specific one in the parameter.

The bold section from the where clause with the SQL Query, is that doable within a BAQ?

Where (TFOrdNum = @OrdNum Or @OrdNum = ‘’)

I posted another thread with mandatory parameter and Brandon posted a solution. I tried that solution and now it is working.

I created a calculated field.

Then in my SubQuery Criteria, I add in the field and calculated field like below.

an alternative would be to check the skip condition if empty checkbox.

Then Epicor ignores the selection in the query.

Your first BAQ would then work.

Thanks for the suggestion Ken. I tried that as well and didn’t work. I needed to have the ability to type in just the Transfer Order Number, just the PackNum, or Both. When they entered both, it should’ve just returned the 1 packnum, which is same as entering the packnum itself. However, it was returning all 3 packnum associated to that transfer order. So the “Skip Condition If Empty” wouldn’t work for that.

The condition would be and vs or.

Order Num and Pack Num

I tried that as well, might have to do something with my BAQ.

try this, and you can alter to OR instead AND between the two parameters if that what you want

1 Like

Thank you. That’s much simpler than what I was trying to do.