I have a drop down based on a ProductName field in a Products data type. In that field the same ProductName might appear several times across records because there are different versions of that product. For instance:
ProductName - Colour - Price
Widget A - Blue - £6
Widget A - Green - £7
Widget A - Red - £8
I have a page where I want someone to be able to select “Widget A” from the dropdown but obviously the dropdown’s captions contains 3 instances of “Widget A” which is suboptimal.
My question is, What do I need to do to get it to display “Unique Items” only? It seems that only the “Choices Source” property has a :Unique Elements option but this doesn’t work and I can’t find anything in the manual or YouTube about this so I’m grateful for any assistance.
All the best
Are the Widget A variation all entries on your Product datatype? Or a separate datatype that relate to entries on your product datatype?
Also, what are you intending to do with the selected item data? Store it on a field somewhere? If so, what type of field is it?
Yes, all “Widget A” variations are all entries in my Product datatype/table (actually called TblProducts)
I’ve had to rethink a bit of the design of the db so now TblProducts contains “Standard” Products and all their variations in terms of size, colour etc. Elsewhere in my app I have a page where each user can add products for sale at their own Outlets with the price they charge at that outlet (there are regional price differences, you see) So I have a PopUp that users will use through which to enter their own variations of the Products in the ProductName field of TblProducts. ie WidgetA, Medium, Green = £7 in London but Widget A, Green = £6 in Manchester if that makes sense.
I want the Dropdown to be able to look in the field of ProductNames in the TblProducts data type and offer the user one of each ProductName so they can select it before putting their own price against it. If that’s possible (and it suddenly seems a whole lot more complicated) I’d love to know how. I’m used to MS Access and in that I’d base the Dropdown on a Query that looks in the TblProducts, pulls out the ProductName Field and I’d choose “Unique Values”. It seems it’s a little different here in Bubble.
Any help much appreciated.
If you only need to refer to the ‘text’ value of the product name, and not an actual product itself, then it’s simple enough.
You need to set your dropdown type of choices to ‘text’, and the datasource to be product’s name: unique elements.
The dropdown will the show the name of each product (without any duplicate names), so you user can select a name from the list.
You can the use that ‘text’ value in the ProductName field when creating a new product entry.