How to dynamically choose a specific database when working with RepeatingGroups

I am creating a website directory for various coffee shops and the coffee items that each shop sells. I currently have several databases created; a main database listed as “Coffee Shops”, which lists 10 unique coffee shops, and then an individual database for each coffee shop that has entries for the different products being sold.

I have a search engine created on the splash page so that users can type in a word to search and a list of coffee shops display. This is done by using a Repeating Group.

If a user clicks on one of the coffee shops from the search results list, the user is redirected to a generic “Main_Page”. What I am trying to figure out/accomplish is getting data from a specific database to pull.

For instance, if I searched for “Joe Schmoe Coffee”, it would re-direct me to the generic “Main_Page” and pull data from the “Joe Schmoe Coffee” database.

Hi @paul.f.saechao,

I’d structure this a bit differently. You really just need one table for all your coffee products. So, 2 data types total:

Coffee Shop

  • name (text)
  • location (geographic address)
  • owner (user)
  • list of products (Coffee Products, list)

Coffee Product

  • name (text)
  • shop (Coffee Shop)
  • price (number)

By having a field under the Coffee Product data type for “shop” which is a Coffee Shop (rather than a generic text, number, etc.), then you can create a relational link between the Product and a Shop. You can also have the reverse ( a one to many) relationship by having a list field under the Shop data type that is a “List of Products”

This way, you only need one table and that “Main_Page” just needs to know which shop you’re working with, and the repeating group’s source can be something like “Current Page Shop’s List of Products” OR “Search for Coffee Products (with a constraint: Shop = Current Page Shop)”

Hope this helps!

Gaby | Private coaching, courses, and tons of free resources

Become a VIP Member for immediate access to 100+ lessons, videos, webinars, and more

1 Like

Thanks Gaby! You are amazing!

Not only did this work for what I was needing to accomplish, this method actually made things MUCH simpler!

Thanks a ton!!

1 Like

Thanks again, Gaby :slight_smile:

You got it :+1: