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)
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”
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?
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.
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
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.
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.