Hi, welcome to the forum…
Firstly, just to check I understand what you’re trying to achieve…
What you’re trying to do is have a separate database entry for each tag (regardless of whether it’s a type or ingredient etc.) So 1 database entry, per tag.
In other words, if a user adds an ingredient tag of ‘tomatoes’ you want a new database entry for ‘Category DB’ to be created with the ingredient ‘tomatoes’ (assuming one doesn’t already exist).
If a user enters 3 new tags (that don’t already exist in the DB) e.g. ‘ham’ ‘cheese’ ‘eggs’, the you want 3 new, separate database entries to be added to the database.
Correct?
If that is the case then you’re on the right track, there’s just a couple of things you need to do differently, so I’ll try to explain as best I can.
Firstly, there’s no need to have the fields on the Category DB type as lists (i.e. list of texts for Main Ingredients DB etc.)
So I’d suggest changing those to single item fields (it wont’ really matter if you leave them as lists, but might just be confusing in the long run).
Secondly (here’s the main place you’re going wrong at the moment), instead of creating a single new Category DB item, with a list of all the new tags, you need to create a new category item for each new tag on the list.
Currently, you’re using the ‘create a new thing’ workflow action, which can only be used to create a singe entry in the database.
So you’re creating a new ‘Category DB’ entry, and adding a list of all the newly entered tags to that single item - which is why you’re getting one entry in the DB with all the ingredients in a single field (as a list).
In order to create a separate entry in the database for each new tag you’ll need to set up a backend workflow to create a new entry, and then schedule that backend workflow to run on a list in your browser workflow, with the list to run on being the list of new tags.
So, based on your current setup, create a backend workflow, with parameters for ‘ingredient’, ‘type’, and ‘time’, all of type ‘text’, and set to ‘optional’ - so you can pass through the ‘text’ to the backend workflow from your workflow in the browser.
This backend workflow just needs one action - to create a new ‘Category DB’ entry, with each of the 3 fields you’re sending to the workflow set to those values.
Then, in your browser workflow, when the button is clicked, schedule the backend workflow for the current date/time, to run on the list of texts from the dropdown (you’ll need to filter the list to only run on entries that don’t already exist).
Set the fields to send to the backend workflow to be ‘this text’.
(you’ll need to create a separate action for ‘ingredients’ ‘type’ ‘time’ to run conditionally - and just send ‘this text’ for the specific field in question, leave the other 2 blank).
The backend workflow will run on the entries from the dropdown that don’t already exist (i.e. those which have been typed in by the user), and will create a new database entry for each new tag.