BAQ Parameters - Replace Slide-Out with on-page Search Filters
Prereqs:
Filters panel card with a search field for each BAQ parameter, and a Search button (as in the Innovative Automation Dashboard Template)
Search fields are bound to the SearchFilters data view, e.g. SearchFilters.FiscalYear
Results grid Where List: set BAQ columns to the entered filters, making them required, e.g. GLJrnDtl_FiscalYear = ‘?{SearchFilters.FiscalYear}’
Note: a single ? ensures the BAQ will run only if the filter has been entered. With a double ? the BAQ could run before the parameters are set and you’ll get the dreaded slide-out panel!
Indicate to the user that the field is required (add *required to the Label Text)
Results grid has “Expand at Runtime” turned off (ensures the BAQ won’t execute before the parameters are set)
Data view to hold the results of the BAQ
1. Modify the Search button onClick event to get the BAQ results using the entered search field as the BAQ parameter
In the event, add a kinetic-baq widget to get the BAQ results. Place it before the property-set widget if it exists
Open the BAQ Parameters section. Your parameters should be listed already. Set each one’s value to {DataView.Column} (the epBinding for your search field).
e.g. Field Name = FiscalYear; Field Value = {SearchFilters.FiscalYear}
5. (optional) Add a condition widget to the Search button onClick event to check for an empty search filter and display a msg
Condition to check for:
Date fields: “{SearchFilters.ToDate}” !== “undefined”
Text fields: “{SearchFilters.ProjectID}” !== “”
My Example: Does anyone know how to get rid of that comma in the Fiscal Year integer field?
I did a test and it seems that whether or not the Baq ID is entered in the Provider Model, the text search field is ignored. If you do include the Baq ID, then you have to click the Search button twice to get your results. When I have some time, I’ll do some testing and figure out how to include additional filters.
I hadn’t forgotten. Took a stab at it a while ago, got stuck, left it, and went back at it again today
You can add the text filter to the kinetic-baq get widget in the BAQ Execute Options in the Where field (e.g. Table_Column = ‘{SearchFilters.Text}’) but this will fail (no results) if you don’t enter anything in the text search field, making it required.
To get around that, you can insert a Condition widget at the start of the SearchButton_onClick event. If SearchFilters.Text is not empty (this expression worked for me: “{SearchFilters.Company}” !== “undefined”), execute the kinetic-baq with the Where clause set. If it is empty, execute the kinetic-baq without the Where clause. This works but it’s not scalable. If you have a lot of search filters, your condition checking could get messy.
This works fantastic - so thankful for the work you put into this.
One thing I haven’t been able to figure out. I’ve got a BAQ with three parameters, there’s a From Date and To Date which are required, but I’ve also got an optional parameter. The BAQ is set up in Parameter Entry with the optional text parameter to “Skip Condition if Empty”.
When I added the three parameters in the BAQ/Parameters area, it works as long as I enter the optional parameter. However, if I leave the optional parameter blank, then when I click the Search button, I think it’s recognizing that one of the parameters is not provided and it pops up the parameter slide-out.
I tried having the two required date parameters being used as you describe here, and removing the optional parameter from the BAQ. Instead, I added back in the BAQ ID under the results grid/provider model and used the BAQ options to add the where list. So, I kind of have a mixture of using BAQ Options with the Where List and using parameters on the Kinetic-BAQ get. However, when I do this, I get the parameter pop-out every time.
I’m using the parameters as I use the date range in both the top level query as well as subqueries - and you just don’t get that same functionality using the where-list under the BAQ options. For my dashboard, the optional parameter is not that critical, so I just removed it from the search filter criteria and the user can run it full-blown and just use filters if needed. But, would be nice to know how to handle optional parameters.
Use a condition to check if you have the optional parameter set in a dataview or not {dataview.column} != "undefined" && {dataview.column} != '' or so, if you do have a value in there, branch true to an erp-baq widget with the optional parameter piped in. if you do not have it set, branch false to a copy of that erp-baq widget with optional parameter set to “send empty”