Search multiple tables at once

  • 1
  • Question
  • Updated 1 year ago
  • Answered
Is there a way to search multiple tables at once?  We have pages that have models for various objects, and I would like to be able to enter text in a single search box, and have all of the tables filtered for that same search string.
Photo of Jared Jones

Jared Jones

  • 2,214 Points 2k badge 2x thumb

Posted 1 year ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
You could put a filterable default off condition on each model then have the select actions of the search component activate and set the value of those conditions then requery the models.
Photo of Jared Jones

Jared Jones

  • 2,214 Points 2k badge 2x thumb
Thanks for the suggestion, Raymond.  I took a run at this approach, but had a couple questions.

I've created filters that trigger filters on other models before, but not sure how to do that with just the search box.

For example, here's how I set up the filterable condition on the model, without specifying a field hoping it would act like a wildcard. (I know, likely wishful thinking)


And here is the select action triggered by the search component:


Is there syntax that pulls the input from the search component?
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
I have not worked much with the filter set that Mark suggests below. It may be a better option. Regarding your question above, you need to use a standard field if you are using multiple return objects so something like {{Id}} or {{Name}}. The way the search component works, you need to select a record that is returned in the search suggestions. Then you can pass a field value like {{Name}} to a model condition.
Photo of Jared Jones

Jared Jones

  • 2,214 Points 2k badge 2x thumb
Got this working using the search component.  Thanks for the pointers, Raymond :)
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 11,050 Points 10k badge 2x thumb
Hi Jared. You might be able to make use of the Filter Set for this. Here's our documentation for this component: https://docs.skuid.com/latest/en/skuid/components/filter-set/index.html

Also, if you have a need to requery a model whenever another model is changed, that's possible through model actions. For example, if Model A's condition is activated or changed, or if Model A is requeried, you can set that up as a trigger to requery model B, C, D, etc. Or, it can take other actions, like activate a condition on Model B, C, or D. In other words, model actions can be a good way to interconnect your models, and you can build some sophisticated solutions around this if you have the need. Here's our documentation for this: https://docs.skuid.com/latest/en/skuid/models/model-actions.html
(Edited)
Photo of Jared Jones

Jared Jones

  • 2,214 Points 2k badge 2x thumb
Thanks for the suggestion, Mark.  I've done something similar before using table filters across multiple models, but couldn't figure out how to get started when it was just the text search.  It's working now, at any rate, and I appreciate the quick response!