Data Blaze Unique Items

Help! Using Data Blaze in my snippet, I want to have the drop down menu only present unique items from the DB column it is referencing that contains categories for each row of data. Therefore, allowing the user to select a single category. I have searched through Docs and the Community to no avail. Anyone? Thank you! :fire:

Note sure if this is what your referring to but I use the GROUP feature of the "select" statement

ie

SELECT Name FROM Testing GROUP BY Name

This will give me a list of unique names

eg

{dbselect: SELECT Name FROM Testing GROUP BY Name; space=1EoSKZIgzmmgelx0YJpd9s; menu=yes}{=Name}

3 Likes

BRILLIANT! Works like a charm. Thank you!

1 Like

Happy to help.

1 more question for you @AndyPage. How would you make the drop down menu not have data in it to start with? I want it to be blank instead of defaulting to the contents of Row 1.

There must be a way but I've never tried that.

I'm sure one of the TB team will have a fancy solution.

There is a "default" value in the documentation but I don't think that actually is what you need.

--

In SQL You would do it like this

SELECT surname FROM contacts
UNION ALL
SELECT '' AS surname;

This would get the list of surnames and then effectively append a "" to the results.

I don't believe TB has UNION ALL so there must be another way

Just came across this while searching, so not sure if you found a solution already - but I was determined to figure it out awhile back.

To do this, you'll need to have a blank row in your Data Blaze table - then in the query, add ORDER BY Name ASC. It should then default to the blank row as the first option in your menu!

5 Likes

Thank you @Karissa_Fiorentino! I did implement that as the solution and it works perfectly. I appreciate you for taking the moments to reply!

1 Like

No problem! :call_me_hand: