Tagify - populating dropdown list from db query not working

Hi Wapplers,

I have inserted a Tagify element and have setup a server connect action to grab data from one my tables.

Now, the database call is working fine however the dropdown of the Tagify element is not working.

My setup is not complicated and I am sure if someone tries to emulate this they will have the same issue.

The Data Source is getthedeal.data.query

I then chose one of the text fields in that query call.

Even though I have dummy records there to display, nothing is showing up in my tagify dropdown list.

The demo that Wappler has on there docs to grab dynamic data for Tagify is from an API call, not the database. Can someone please check if a database call works for Tagify?

If someone has it working can you please post a screenshot of your setup?

Thanks!

It doesn’t matter if it’s a database query or an API data source, it works the same.
Maybe show what you’ve selected in the Tagify options and also check if there isn’t any error with your server action: Debugging Server Connect Errors

Hi Teodor,

Thanks for your prompt response.

No errors being shown.

Setup is as follows:

NodeJS
Postgress
Docker

Screenshot of tagify:

Also, the field I want to show from db is a text field type with multiple values, for example: value1, value2, value3… hence why I want to show them in the dropdown.

Not a JSON. Does that matter?

Tagify expects an array returning values, you have a single value with a comma separated list of values. You also need to select a value in the value option of tagify.

In that screenshot it looks like you hit the bind twice the text is duplicated

getthedeal.data.querygetthedeal.data.query is what you have there maybe try

getthedeal.data.query

how do I return an array? Do I need to change the field type from text to something else?

Still nothing… I think Teodor is onto the issue… It’s returning a list of values with commas not an array. Any tips on how to return an array?

Also what should the value be? Array as well?

Text and Value field is now this:

loanpurposes.split(’,’)

In order to try convert it into Array.

Still empty…

I could be wrong but if loanpurposes is a text field comma separated then I believe you should be using this as the data source:

getthedeal.data.query.loanpurposes.split(’,’)

As for the value and text with this been a comma array I’ve never tried this but maybe in code view try:

$value

Your data source must be an array, not the text and value fields.

What @Sorry_Duh suggests should work there, but your data structure is just not correct. You should not store the values like comma separated list in a single row, but store each value in a separate row.

1 Like

Thank you both for your replies.

So what I am trying to achieve is as follows.

I want the user to be able to select 1 or multiple items in a dropdown form (i.e. the tagify input) and then it saves to the database.

What I am having trouble with is Tagify grabbing the already saved values to prepopulate the tagify form and also the static list of options for the use to choose from in the tagify form

Okay I have figured this out thanks to both your help. Thank you! The only question I have is the choices that the user makes comes from the data source from my database, which I don’t need it as a database record. I would much rather have it as a static list of items. Is this possible?