Search multiple tables at once

  • 1
  • Question
  • Updated 3 months 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,246 Points 2k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 18,336 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 Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 18,336 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,246 Points 2k badge 2x thumb
Got this working using the search component.  Thanks for the pointers, Raymond :)
Photo of CM

CM

  • 262 Points 250 badge 2x thumb
Jared, can you explain how you got this working using the search component?  I am trying to search multiple models using a single search component, and not having much luck.  Thanks for any help you can provide.
Photo of Jared Jones

Jared Jones

  • 2,246 Points 2k badge 2x thumb
Hi CM.  Mark's comments below led me to my solution.  Not sure if what I did is applicable for current versions of Skuid.  I see that Mark's links in his comment below have gone stale.  I think the key is that even if the objects are different, they will have a field type in common, such as name or user.  If I get some time tomorrow, I will upload screenshots of my (outdated) configuration in the hopes that that will be helpful for you.
Photo of Jared Jones

Jared Jones

  • 2,246 Points 2k badge 2x thumb
@CM - Sorry it took me so long, but here are the screenshots.
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 12,352 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,246 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!