Connecting Data fields with other data types

Hi - I’m trying to create a repeating group where I can take fields from 2 data types.
My data types are User, Vendor and Products
Vendor Data type has:
Name as text
City as text

Product data type has:
Name as text
Price as number
Vendor_account as Vendor

When I set up the repeating group block with Product, it displays the correct datal but when I add the vendor_account info (Name & City) I’m not able to display the information. (code: Current Cell’sproducts’svendor_account’sname)

Can someone let me know what I’m missing?

Thank you
Axel

1 Like

Hi axel.schallies,
I think the easiest way to do this would be with “:append”.

To my knowledge you can only select one data type for your repeating group. However, when you define the item in the repeating group you can append search results from other data types. The key is that you need the SQL equivalent to a foreign key constraint which in your case would be the vendor field in both tables.

So, your ‘Type of content’ might be “Products” and your ‘Data source’ “Search for Products”. Then in the RG item you would put “Current Cell’s Product’s Name :append Search for Vendors” and in the constraint field you would put “Vendor = Current cells Vendor Name”

Hope this helps!

BR,
Will

2 Likes

Hi willday33,

Thank you for your suggestion but when I’m in the Vendor step, where I need to add the Vendor after do a Search for I’m getting an error message “This argument should be a text but right now it is a List of texts” Am I missing something? Any suggestions?

Thank you for your support again,

Axel

Put a constraint on the search for the vendor. And I think you may need to add ‘:first item’ to the end of the search.

Here’s an example from one of my apps.

In my example “TOBset” would be your “Product” thing and “Video” would be your “Vendor” thing. The matching field in each table is “SetNum”. For you it would likely be the vendor name.

image

Willday23,

It’s working but now I’m getting the first vendor name in the field in all the fields instead the right vendor because of the :first item command. This command asks me to add more data.
I’m into something here. Let me try different things and I’ll get back to you unless you have another suggestion.
Axel

Did you remember to set a constraint on your search for vendor?

Can you post a link to your app? It would be easier to troubleshoot if I could see your setup.

Yes, I would appreciate your help https://bubble.io/page?type=page&name=testing&id=elsvents&tab=tabs-1

Axel

I’m getting access errors when trying to access your app. Can you make sure you have application rights set to “Everyone can view”

https://manual.bubble.io/application-settings/private-and-public-apps

Good Morning,
it’s all set! please try again https://bubble.io/page?type=page&name=testing&id=elsvents&tab=tabs-1

Hi Axel,
This issue is that you are trying to link data from two tables but there is no association between the items in those two tables. You need a field that links the product and vendor table. The concept is similar to a foreign key in SQL. It could be a vendor name, account number, etc. The important thing is that it has to exist in both tables. The field doesn’t necessarily have to be named the same, but the value has to match in both tables. i.e. In the Vendors table you would have a ‘Name’ field with the values (“Puma”, “Adidas”, “Nike”) and in the products table you would have a ‘Vendor’ field which would contain either “Puma”, “Adidas”, or “Nike”. Then you could return results from the Vendors table (location for example) that is linked to a Product.

https://www.w3schools.com/sql/sql_foreignkey.asp

Thank you for the support. I will follow up on foreign key… :slight_smile:

No problem!

As a note, the term “foreign key” is a SQL / relational database concept that you will not likely find much reference to in the Bubble forums. But, understanding that concept will help to better visualize what data and logic you need to build into your Bubble app.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.