Filters: custom OR free but not both?

Working in a to-do app, and have built page for the Tasks table. I created a basic handful of “canned” filters for users to click on to filter to record sets they will want to see all the time:

  • do today
  • overdue
  • all open tasks
  • closed tasks
  • everything

Now I want to be able to let users filter records in other ad hoc ways. For example, I would like user to be able to filter for records where date = tomorrow (with tomorrow’s date selected of course from a calendar drop-down). But it looks right now as if Knack will not let me provide users with ad hoc filters AND a handful of canned, common filters. Can this be true?

Huge drawback if that’s the case. I really need to give users the ability to find/filter records in any way they can think of. But I can predict the three or four filters they’ll want to do most frequently, and I’d really like to have those available, too, for one-click filtering. Nuts to require users constantly to define an ad hoc filter to see today’s tasks.

But so far, pretty much every time I think something can’t be done, I am happy here to find out that I’m wrong. So I’m hoping you can tell me what I’m missing. :slight_smile:

1 Like

I currently do this with custom code, but I would love to hear if the community has thought of a No Code solution.

Hello William,

This is possible in different ways. Like create a menu first and add a table in each tab with different filters.

you can check-in link below

https://roberts.knack.com/farmers#testmenu/today-records/

Regards,
Sunny Singla
ssingla1985@gmail.com

Thank you, Sunny, and for the link. But if I may, a follow-up question or two. I don’t quite understand what you’ve done.

Here is the pertinent area of your app.

Now here is the same area of my app, in its current state (2022-Apr-08):

I’m guessing that your three “tabs” (Today Records | 30 Days Records etc) are actually menu buttons. But they look like my buttons (Do Today | Overdue etc) which were created by the app’s builder as filter buttons. And note that I already have a navigation menu up above (to go to Tasks pages, Projects, Notes).

I’ll play with this some more but I don’t right now see how to add another navigation menu like I assume yours to be, down where the filters menus are.

I do notice by the way that you have an Add Filters button down there for ad hoc filters, which is great.

For this, you need to first create a screen with only a menu

then add multiple views in this menu

Thanks for staying with me, Sunny. But you’re giving me a little more credit than I deserve. I’m getting up to speed quickly with Knack but still don’t quite grok all these clever workarounds.

You say “first create a screen with only a menu”. By “screen”, you mean “page”, right? What kind of page: public, login or drop-down menu? I’m guessing public page. But perhaps by “screen” you actually meant “view”, with the view being a static menu. And in that case, I’m guessing that this link-to-existing-page menu should be placed right on one of the existing pages with a table.

And although you said, “first create …”, I’m assuming that *before I create the menu I need to have created the three pages that have identical versions of the table except for the different default filters, right? I mean, I can’t point to the pages from a menu until I have pages to point to, right?

I know how to create pages, add menus, have the menus link to existing pages, etc. So despite the questions above, I’ve been playing around with the options above and I reckon I’ll hit on something eventually.

But I’m completely lost trying to get from your first screenshot (“first create a screen…”) to your second (“then add multiple views in this menu”). I know how to create a dropdown menu (which is what it looks like you’ve done). I just don’t see how that comes into play here at all.

Be most grateful for just a couple more clues! THANKS.

Hello William,

  1. create a page(public or login).
  2. Add Menu.
  3. Under menu client new child page (for all options you need to create a new child page)
  4. Select the Last 2 checkboxes. Tabbed menu and auto link

Regards,
Sunny Singla

By George I think I’ve got it. I played with Sunny’s detailed instructions. Peter G. and Carl Holmes both contacted me back channel and helped me achieve full understanding of Sunny’s responses. I’ve written this up for my benefit and the benefit of anybody else who needs, as I do, to be led by the nose. :slightly_smiling_face:

.

Providing canned filters AND ad hoc filters

2022-04-08

In my Tasks database (as in many other projects I do) I wanted to be able to provide canned filters for users to pick. In Tasks, it makes sense to have a canned filter for tasks whose date = today, and to allow the user to click on a button to see those tasks quickly. And once I’ve done that, it makes sense to provide a couple more quick filters: to show overdue tasks (date < today), upcoming tasks, ALL tasks regardless of date, and perhaps all tasks that have been completed.

Sunny in the Knack Forums threw me the big clues about how to do this but I didn’t follow him fully. Peter Greulich offered to walk me through it. And Carl Holmes contacted me back channel to provide excellent links to videos (here and here) showing these techniques. I owe my understanding entirely to them. I did not figure this out on my own. I’m writing down the steps below to review what I’ve learned from them and to help me remember it later.

The basic idea is pretty simple: You create multiple pages, each with an instance of the same data table but with different default filters. You then create a menu to jump between the views.

Canned filters for Projects: Active, Inactive

I said above that I first faced this problem in my tasks database, in the Tasks table. In this recipe below I’m switching to the case of making canned filters for Project records. It’s the same concept. This assumes that I’ve started with a page that has a table view for Project records on it already.

  1. Go to Pages area of the builder .
  2. Create a blank new page. Can be public or login. I’m going to make it a login page. Name it Projects Nav. Knack will automatically create TWO pages: One called “Projects Nav” (the one I’m about to work with) and a parent to that page called Projects Nav Login. Going to ignore the login page.
  3. You’re now asked to add a view. Under Static Views, drag a blank menu view to the page. The menu view initially says “This menu is empty” and invites you to put something into it.
  4. Before continuing with the menu object, at the bottom of the Build Menu panel, check both “Tabbed Menu” and “Auto Link”.
  5. Now, back at the top of the Build Menu panel, click “Link to a New Page”. Give the page a name. I’m naming mine “Active”. Click “Add Menu” to save the menu object, then save changes to the page.
  6. Click on the menu view again, and add another item. I’m calling my second item “Inactive”. Submit, save changes to the page.
  7. You should now be looking at a little hierarchy of pages. In my case, the hierarchy looks like this: Project Records Login < Project Records < first page named “Active”, second page named “Inactive”.
  8. Go to the original Projects table view page (the one I said at the start I assume you already have created) and click on the table view there that you want to use as a model for the table view in your new pages.
  9. Hover above the table’s ellipsis “…” menu and select Copy. Pick a page to copy the table to. In my case, the first time I did this, I copied the page to the Active page I created in step 5 above. Confirm what you’ve done and click Continue. Then click Go to New Page.
  10. You’re now looking at the first of your “menu-controlled pages”. Click on the table that was copied to this page, and then on Source in the Edit Table panel on the left.
  11. In Edit Table/Source panel, click link “Add rules to filter records”. Define the filter that you want to control which records appear in this table by default. I picked Status = “Active”. Save changes.
  12. Click on the table view once again, and this time in the panel on the left go to Settings. Under Filter Options, set the filter options you want users to be able to have. I set my page up so users can define their own filters. Remember that any filter created by the user this way will be filtering the set of records you already defined in the previous step. In other words, if this table is permitted only to show active projects, if users filter projects that have been assigned to (say) Larry, the record set returned will show only Larry’s active projects.
  13. You can now click on the table you’re looking at and repeat steps 9–12 above, making appropriate changes to the default table filter. In my case, for my second page, I made the default filter show project records whose status = inactive.

And that’s basically it. The steps above will create multiple pages, each containing a view of your table that is identical initially (because the views were created by being copied from a model) and each of which displays a record set limited by a default record-source filter.

You must now keep in mind that you’re actually dealing with multiple distinct instances of the table view. If you want your table to appear unchanging when user clicks on one of the filter tabs or another, and if you make a change to one of the instances of the table, you’ll have to make the same change to the other views. On the other hand, if you want to have different views showing different columns, you can do that.

You may have to do some clean up now to handle creation of new records and other workflow issues.

Explaining the trick

The “trick” here — what made this seem like magic to me at first — really occurs in step 4 above, where you check both of the options at the bottom of the setup panel: to create a tabbed menu, and to auto-link to the first page in the menu. The auto link means that the user never sees that page where the menu was created, which is otherwise a blank page. A secondary mystery that I don’t fully understand lies in the fact that this menu page passes the menu to the two “child” pages linked to from the menu.

Quite clever and fairly neat. Many thanks to my many friends here.

1 Like

Brilliant, Sunny. THANK YOU for following up with more details. I’ve gotten it now (with a little extra help from Peter G. and Carl H.) but you got me going down the right path.

I’ve marked your response as the solution. And I’ve added my own ‘recipe’ below so I can find this again in future. If I’ve gotten anything wrong in that recipe, let me know. Many thanks to you and Peter and Carl (and to Ian, too, for reminding me that there are always other ways to solve these problems.

William

Following on from Sunny’s excellent reply and solution, the below video may help others to understand the concept further.
Like most things in life, its pretty simple when you know how :blush:

2 Likes

Thanks everyone for this great info.
Have wanted to achieve this a few times before, so will be very helpful!
Craig

1 Like

Hi William,

Here’s my solution to your dilemma, without compromise! You get the best of both worlds: custom filters created from knowledgeable users, yet distributed to all users.

No coding is required - and it’s Open-Source, FREE

Check out the KTL’s new Public Filters under the User Filters’ section.

Of course, you have to tackle the 10 minutes setup procedure, but you’ll be ok!

Any question or feedback is welcome.

Full documentation found here: Knack Toolkit Library

Enjoy,
Normand D.