Forum Academy Marketplace Showcase Pricing Features

Delete database entry - should be simple, but can't do it

Hello Bubblers,

Context
Let’s say I have to separate tables: User and Courses
Users can add their preferred courses to favorites.
For this reason I have a list-field “SavedCourses” of type Courses in the User’s table.
The linking of “User” and “Courses” enables me to translate the unique IDs of the saved courses into the names of the courses on the User’s favorite list in his dashboard.

What I want to do
The User shall now be able to delete courses from his favorite list (which shall delete the uniqueIDs in the SavedCourses list). I don’t want him to delete courses from the Courses table.

The Problem
This is where my problem starts. I can’t tell bubble to delete the chosen entry from the RG from the database. I guess the issue has something to do with the type of content set to “text” in the RG and the change to a thing of type “current user” in the workflow, but I tried hundred of different ways and could not do it. Any hint?




Why are you using Text as the content type for the RG instead of Course?

It would be simpler to have the RG’s content type as Course, then you can just remove the current cell’s Course from the User’s list of Saved Courses.

If you want/need to keep the RG content as text, then you’ll need to search the database in order to find the course you’re trying to remove, and match it based on the course’s name (if it’s possible to have more than one course with the same name then that will be a problem).

So search for courses who’s name = the current cells text, then select the first Item from the returned list as the Course to remove from the User’s list of saved courses.

But it’s much more logical and simple to set the RG content type to Course (unless there’s some specific reason why you don’t want to do that), and then just remove the current cell’s Course.

I chose text, as this was the only thing which worked for me. If I change the RG type of content to Courses, this is what I get.

Hi there, @tobias2… stop that expression after Current User's SaveCourses2 (i.e., get rid of :each item's Name). Then, have the text element in the repeating group display the Current cell's Course's Name. Finally, as Adam said, when you are removing a course from a user’s list, simply remove the Current cell's Course.

Best…
Mike

1 Like

Great, that trick did it. Thanks so much for your quick support @adamhholmes and @mikeloc. It works now after changing type of content to courses.

2 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.