Add a filter that applies to all of the tables on the page

  • 1
  • Question
  • Updated 3 years ago
  • Answered
Objective: View multiple tables with data from multiple custom objects on one page with two filters that apply to the whole page. 

Filter One: Id from one custom object ("Instructor")
Filter Two: Date Range from "Start" and "End" Date in another custom object ("Payroll Period')

FILTER ONE: Possible Solution
One solution that I thought of was to create a page with the parameter set the the instructor id, "Instructor_Payroll". This page would have a condition to view only the instructor in the param id. 

Then create a tab page with one tab per instructor. Each tab would have the "Instructor_Payroll" page on it, but the parameters would be set to only view the specific instructor that the tab is name after. Opening the page would then force the instructor filter, so you would only see the records related to that instructor. 

FILTER TWO: Possible Solution
If the include page controls filter the page by instructor, I now only have to filter the page by the date range of the payroll period.

Unfortunately, the records that need to be included in payroll do not have values in the "payroll period" field until after the payroll is processed. So, the purpose of this page is the find the records in that period so that they can be associated with the payroll period.

There is a custom object in our system, "Payroll Period" which does have the start and end date of the period that we need. I need a solution that will all of the tables on the page, which are from multiple custom objects, so that they all filter to see only the records in a specific pay period.

What I would like to do instead is to have a process where I can:
  1. Select the Payroll Period (custom object called "Payroll Period")
  2. Query that model to find the Start and End date fields
  3. Pass these values over to activate conditions for each table on the page to only view records that have dates between the start and end dates.
How do I do this? A button with actions? A button with javascript? A queue? 

Any ideas?
Photo of Anna Orias

Anna Orias

  • 1,468 Points 1k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
I don't know if this is what you are looking for, but maybe you could create a one row model based on a new "payroll period selection "object. This object would just have 4 fields: a name set to auto number, a reference to choose a payroll period, a formula field that is equal to start date of payroll period, and a formula field equal to end date of the payroll period. Set the model to not load data on page load and to have maximum 1 row and to create new row if no rows are present. Also put a model action to save the model if any fields in rows are updated and a second model action to query all models if a field on the payroll period selection model is updated. Put a field editor at the top of your page in edit mode that includes your "payroll period selection"object's payroll period reference field . Then row 0 of that model will contain the information you need to create conditions on other models based on date range. When the page loads, the field editor will appear prompting you for a payroll period. All other models will be conditioned on your entry to this field so on page load no records from other models will be displayed. Select the payroll period and your model action will automatically save the record making it row 0 in your model. All other models with conditions based on row 0 of your payroll period selection model will be queried and the only those in the date range you are looking for should be displayed.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Here are some topics where this is discussed.  I think you'll find an answer here: 

https://community.skuidify.com/skuid/topics/add-global-filter-on-top-of-page-that-apply-on-multiple-...

https://community.skuidify.com/skuid/topics/cross-model-linked-conditions

https://community.skuidify.com/skuid/topics/filter-calendar-by-user-using-the-action-framework  (This intoduces the concept of "arbitrary filters" where one field selector controls a number of models through the action framework.  The example is with a calendar,  but it can be used with any model-bound component.)

Here is some XML of an opportunity dashboard where one set of selectors controls a model using the action framework.  It could be expanded to control multple models. 
https://raw.githubusercontent.com/skuidify/SamplePages/master/ActionRecipies/Arbitrary%20Filters%20-...

Hopefully these resources get you going.  
Photo of Anna Orias

Anna Orias

  • 1,468 Points 1k badge 2x thumb
Thank you both. We got it to work with your advice!