Share feedback, ideas and get community help

Updated 5 months ago

Repeated buttons from Sheets database

At a glance

The community member's post describes an issue where repeated text in a column of a sheet used as a database is not displayed uniquely when dynamically shown in buttons. In the comments, another community member acknowledges the issue and tracks it on a GitHub repository. A third community member provides a solution using JavaScript to filter out duplicates and return a unique array.

Useful resources
When using sheets as a database with the HTTP request the expectation is that repeated text in a column will be shown once when displayed dynamically in buttons. However this is not the case, the same text will show many times as it appears in rows.
Attachment
Typebot_2024-04-28_195517.png
B
A
3 comments
That's a good point
Sorted on my side with

const provincesArray = {{provinces}};
const cleanedArray = provincesArray.filter(element => element || element === 0);
// Convert the array to a Set to remove duplicates
const uniqueSet = new Set(cleanedArray);

// Convert the Set back to an array
const uniqueArray = Array.from(uniqueSet);

return uniqueArray; // [1, 2, 3, 4, 5]
Add a reply
Sign up and join the conversation on Discord