Ignore BAQ Table Criteria When Checkbox is Checked

I’m not sure this is possible, but I would like to ignore a BAQ Table Criteria if a checkbox on my dashboard is selected. We are multi-Company and this is a Cross Company dashboard with a parameter to select which company is shown on the dashboard. I want to add a checkbox that when checked will show the data for all companies in the database and ignore the company parameter. I figure if it is possible someone here will have a solution :slight_smile:

If you do the filtering the subquery criteria, you can filter by a calculated field. You can add a parameter, Then add that value to calculated field. Then you can use a “Or” filter to all all.

image

image

allCheck

1 Like

Or you can just use the ‘Skip condition if empty’ option when you add the param in your BAQ. With that, if you leave the param empty, it will show all companies.

1 Like

I have implemented this solution. Haven’t had a chance to test it yet because I seem to have other query issues, but it seems to me like it will do what I am looking for, thank you!

So this code works great. However. When I run the dashboard that the BAQ is assigned to and hit the checkbox I get this error:
image
This is interesting to me because this Calculated_AllCompanies is the same as your “AllCheck” it just holds the value of the parameter in order to check it in the subquery criteria. How would a boolean parameter be trying to pass <> as a value? Hitting ok on the error makes the dashboard continue to work, but the checkbox shows false even though it’s value is true.

I have it working on a dashboard for me, so you have something in the setup wrong. Can you show me the criteria that you have set up in the subquery criteria?


I should note that this is a union all query but I don’t think that would cause any issues?

You have the calculated field in both queries?

Add a bunch of screen shots of what you have. It’s really hard to try and guess what’s tripping you up with only bits and pieces. If I can see the setup, I might be able to spot the problem.

DB-ShippedNotInvoicedCrossComp.baq (121.0 KB)
Here this may be easier.

So if you aren’t harcoding a value, why not do what @Dragos suggested, and just skip condition if empty?

A wise man once told me that users are dumb and to code things with that in mind. If he wants to out himself here he can :smiley: My worry is that blanking out the company to see all companies won’t make sense to a user without extra training.

Making these field required, when they aren’t actually required, (cause you clicked the all companies box) is also confusing.

image

All of the filters in Epicor (heck the world) work by not filtering if you don’t type anything in them, so if the users can’t figure then out… well… :person_shrugging:

But, since this is what you are asking, here’s the BAQ back with some minor modifications.
I removed an unnecessary layer in your BAQ (not sure why you had a union, a subquery, then another top level) I also removed the required on the checkbox. That’s probably what was messing you up.

DB-ShippedNotInvoicedCrossComp.baq (121.0 KB)

You are right the mandatory parameters make no sense I am not sure why I did that in the first place.