Workflow - Replace line item in the database

I’m in need of a little help.

When I click a star icon I would like to create an entry into the database (Saved-Rating = 1 (if star icon is 1), which works fine), If there already is an entry Id like to replace it and this is where Im having difficulty.

I have a Star Rating data type and a field called Saved-Rating.

I also have a Field data Type that links to the above data type called Rating

I have a workflow for when the icon is clicked:
Step 1

Step 2

Here is what the database looks like Rating is the last column.

This is where it keeps creating another line item and if I click the star icons a bunch of times for that cell they will keep piling up, instead of replacing the item in that cell.

This last screenshot is just an image taken from the front end:

Hi there, @luminrabbit… so, first, it looks like you are using individual star icons to create your rating feature because you have a workflow associated with each icon. if you wanted to simplify things from a workflow perspective, you could consider using Bubble’s plugin called Bootstrap Star Rating Input.

The above being said, you should be able to do what you described by having two workflow events associated with each icon. One of the events would be when an icon is clicked and the Parent group's Field is empty, and that would be the event that creates a new thing in the Star-Rating data type and assigns that thing to the Parent group's Field. The other event would be when an icon is clicked and the Parent group's Field is not empty, and that event would make changes to the Parent group's Field's Rating instead of creating a new thing in the Star-Rating data type.

Any of that make sense? I hope so, and I hope this helps.


1 Like

Hi Mike,

Thank you so very much, that does make sense and is extremely helpful!

That’s a pretty nifty trick (I like it a lot)! Thank you again :smiley:

1 Like