Allow user to Delete / Archive a row from database

Hi everybody,

happy to be here my name is Andrea and this is first post for me, so please be indulgent. Also, thanks to Bubble & the community which helped me a lot already in building my web app!
Here I come with my first issue which I could not find a steady answer (if as I think it is already somewhere, please be kind and share link).

I am building a app where the user can create records which of course reflect in dedicated database; the referring database has a picture and a description, so the user uploads a picture and a description, then using repeating groups I created a list (on same page so not to multiply pages as I see this is overall recommendation) of all records created by them.
Also, in the database there is a “status” cell which can be “created”, “cancelled”, “seen”, …
I am now stuck as for each line showed by customer I added a “delete record” text and what I want to happen is that once “delete record” is clicked, Bubble finds the corresponding row in database (I assumed the unique ID cell could be the good way to link them) and does two things:

  1. delete that records from user interface
  2. eventually keep it in the database but not anyone possible for the user to see (I considering whether to keep the record in the database or simply delete it also from database)

So the logic that I am trying to implement is (here the idea including option 2):
-look for “uniqueID” in the database (there is a hidden collapsed cell in the record displayed to user with “uniqueIDs” from database)
-change the “status” cell to “deleted/archived”
-put in the repeating groups a condition to not show/consider the database rows where status is “deleted/archived”

also although this is not the way I would go I would also like to know how to make possible that user clicking on “delete” button would be able to delete the row from database (this way of course it would not be visible but also data would be lost).

Again, I think this is quite easy task but I tried couple of hours without having success, this would also help me in database management in future for sure so thanks a lot to everyone who would be nice enough to help me (once the web app will be unicorn I will remember about you :skull:).

Finally I am not native English speakers nor a professional developer so excuse any typo or inaccurate wording.

Cheers,
Andrea

It’s much simpler than that.

When ‘delete record’ is clicked, just run a workflow to delete the current cell’s record.

Then include in the RG search a constraint to only show items who’s status is not deleted (you might also want to set up a privacy rule for this instead or as well).

1 Like

Hi there, @AndyFat… if I understand your post correctly, all you have to do when the delete link is clicked is use the Make changes to thing workflow action to make changes to the Current cell's Thing, and the change to make is set the thing’s status field to deleted. Then, add a constraint to the search in the repeating group’s data source where status <> deleted, and you should get the desired result of deleted records not showing up in the repeating group.

Hope this helps.

Best…
Mike

1 Like

hi @mikeloc,

astonished by the swift answer, then considering you solved my problem this is 10+!
Thanks a lot also because you unlocked a skill that will make my job lot easier in the future.

Super!
Best,
Andrea

1 Like

@adamhholmes you guys are quite too quick, I did not see you answer and went to @mikeloc one which worked, I will investigate deeper your suggestion as the privacy thing is intriguing and important in my opinion.
thanks so much to you also!
I will have fun in this community for sure :slight_smile:

1 Like

@adamhholmes @mikeloc
I would like to take advantage of your availability on another functionality I got stuck since I fixed the other thanks to you.
In the group where I show the list with a sneak peak of all the record created I would then like to give the chance to click on it and transpose the data in a. new dedicated group, for example, for each records there are 5 photos, I am then showing in the list just one and a description truncated.
Of course the group I designed has the space for all the 5 pictures and larger sized textbook to show full description, I’m struggling to get the group I created filled, only thing I was able to workout was to fill with the “:first item” off the record list from database, but I want of course the data concerning the specific database row referring to the recurring group user clicked.
Any chance this is as easy as before?

Thanks a lot,
Andrea

PS I might maybe have to open a new thread but this would be quite more complex to explain so I try here

I’m not sure if I fully understand what you are saying, but if you are trying to display the details of a thing in the repeating group in another group when the thing is clicked in the repeating group, you can do that by using the Display data workflow action.

So, add a group to the page, and set the group’s Type of content to be the same as the things being displayed in the repeating group. Then, when a thing is clicked, use the Display data workflow action to display the Current cell's thing in the group. At that point, you should have access to the details of the current cell’s thing in the group, and you can display those details as you wish.

1 Like

wow, thanks for steady answer looks like you got the point, I was trying that (found out the options after some try and error), now I keep trying for a while and come back to you.
Thanks

ok, main issue I find is in:

" add a group to the page, and set the group’s Type of content to be the same as the things being displayed in the repeating group"
→ I try to do that, but in the repeating group I have data source: search for “records”, and when in the top parent group I try to do the same I get error pop up telling me that “the data you’re displaying is a list of records whereas it shows be a single record”, which makes sense to me indeed but I don’t know if could be just there the issue or there was something more I need to do?

You don’t need to set a data source for the group… just set the type of content and leave the data source empty because the latter will be taken care of when you use the Display data workflow action to tell the group what to display.

1 Like

…aaaand it’s gone.
Thanks so much!
Do not worry I will be back as what I do have are a very particular set of skills. Skills I have acquired over a very long career -in project management-. Skills that make me a nightmare for people -so nice-* like you* :slight_smile: :sweat_smile: :sweat_smile: :sweat_smile:

1 Like

You probably want to post future questions in new topics so folks other than Adam and me can jump in and try to help out (although, it might still be Adam and/or me anyway because we’re around a lot).

1 Like