Forum Academy Marketplace Showcase Pricing Features

[RESOLVED ]Repeating Group - Combining different types

I have the following

  • Producer DB
  • Produce DB

Producer DB is like users - here the farmers / producers join to become producers on the platform
Produce DB is where Producers who have joined add their produce for sale

On the shop page https://farmbuddy.bubbleapps.io/version-test/shop people are allowed to view and buy from the Producers.

I am using a Repeating group on the shop page. Everything looks good , except the the red circled parts

Whilst everything in the cell is Current Cell’s produce. The bits that are red are Producer based - Producer image and Producer name. This mismatch is because I have set the repeating groups type as PRODUCE and then I try to display PRODUCER info… but I can’t figure out how to overcome this. Any help?

Repeating Group’s setting

Each cell setting can be found here https://bubble.io/page?type=page&name=shop&id=farmbuddy&tab=tabs-1

You need to attach the Producer to the Produce. So in your Produce data type, you should have a field called “Producer” that is type Producer (vs text/number/etc). However your produce gets added, make sure that Producer field is also accounted for. Then, in this repeating group, where you have it in red, your text will be “Current cell’s producer’s name”

3 Likes

Ah OK… thanks. I was hoping there is some way to connect the two separate DBs ? Or is it that we can never have relational database in Bubble?

Do you mean Producer and Produce are in two different Bubble apps?

If you have a single Bubble app, you can definitely have relationships between different data types. If you look at your database, you’ll see that User is a built-in data type. You want to add a Produce type and Producer type. Within each type, you can set-up the fields for the related information for those types.

Producer would have, for example: name (field type text), location (field type address), list of produce (field type produce and it is a list)

Produce: name, price (field type number), weight, image, producer (field type producer)

Adding those fields whose types are another type in your database is how you cross-relate information.

No, all are in the same app. So I should correct myself. They are in one DB. But to connect the two tables I need atleast one identifier, which in this case should be Producer details. And through that I can then query Producer and Produce together. Gotcha…

1 Like

Exactly :slight_smile:

Hey @romanmg sorry to bother you, but when I try to add the Producer to the Producer this is what I try to do in the "Create a thing " workflow

However , for me to populate the Current Producer’s Producer Name it expects more things after the Producer Name. I can’t actually get the query right - link to the builder pager here https://bubble.io/page?type=page&name=addproduce&id=farmbuddy&tab=tabs-2

Any idea what am I missing? I was hoping the query to be Do a search for Producer’s Producer Name’s Value (where constraint is Created by Current User) - but I don’t get the 's value as an option and yet Producer Name expects something after it.

2 things:

  1. You just want the field to be equal to a Producer as a whole, not the Producer’s name. If itemProducer is type Producer, it is looking for a Producer, not the Producer’s name (which is a type text). The text in the repeating group is where you retrieve the name to display. When you set up your cell in the repeating group, you’ll be able to access all Producer fields including name because you’ve attached the Producer’s entire entry to the produce item.

  2. The search is looking for 1 entry, so you need to specify which single entry from your search query. So you’d want “Search for Producer’s first item” with that filter you have.

However, are your users the producers? It might just be easier to say “itemProducer= current user” since the current user is a producer and you only want the current user’s producer information to be attached to this produce.

3 Likes

It looks like you’re trying to put a different data-type into that slot.
Change the ‘ItemProcucer’ data-type from ‘producer’ to ‘text’.


2 Likes

OFF TOPIC - very nice app! Love the light grey and green font, the food icons and food images.

1 Like

This was my bad. Sorting it out, worked correctly for me.

A combination of @romanmg explanation and your correction gave me exactly what I wanted.

So basically, I need to store the Producer details with the Produce if I need to show any Producer information on the Produce. Thank you.

2 Likes

I have a user table, but my users will be added as Producers (I’ve created a separate table for Producers). I am going to try point 1 in detail on my app - because eventually, I want to have to freedom to pull in any Producer information on my Produce so joining those two tables (and learning how to do that properly) is important. Thanks so much.

1 Like

Thanks @csfalcao

1 Like