Cannot clear a n-1 relationship

I have no clue what I am doing wrong. I tried so many things, but I could not get it working.

Here’s the thing:

I have a class where I want to add multiple students. A student can only be in one class.


I can show the checkboxes properly. I can also add someone to a class:

If a student is in a class, I also want to be able to remove him/her, but somehow I cannot empty the class field in the student row.

It seemed so simple, but for some reason, this is more complex than I expected. Or am I somewhere making a thinking mistake?

Thanks for any suggestion/hint toward a solution.

You’re not doing anything wrong @Toms

Adalo doesn’t let you clear a one-to-many relationship by default.

I have a work-around for it but it does add a couple of actions.

Here’s what you are trying to do:
“Update current student > Remove current class”
(but this is not an option).

Here’s what you can do:
“Create New Class > Update Student (Add New Class) > Delete New Class”
This will create a new blank class, add the student to the class, then delete the class, thus clearing the field.

Hi Flawless, good to know that I am not doing anything wrong, but what a pity that it must be this complicated.

I think your idea also doesn’t work for me completely. A class can already have other students, so I cannot create a new class and then only add the current student.

With an n-n relation I can add and remove the class from the student. The only risk here is that you can add multiple classes to one student, which shouldn’t be the case.

Hi @Toms,

Maybe you could do something like this : Current Class Students.mp4 on Vimeo

Hope this will be good! Also you can add this as a feature request too! :

Thank you


@dilon_perera Amazing!

1 Like

Thanks for the suggestion @dilon_perera. I cannot add unassigned students to classes with your solution anymore right?

You mean assign students for classes in the edit class screen? You can do that by a update action! Did I not got it correctly??

Yes, but I don’t see them anymore in your example right? If you uncheck them, they’re gone. Or do I understand your suggestion not completely (there is no sound with your movie right)?

Do a Custom Action PUT API call to your Adalo collection and JSON body:


Oops. I think I missed that! Tom, is this correct of what you need? : Add and Remove Users from Classes - Preview.mp4 on Vimeo ( sorry for not having audio )

@rozza, I really like your solution. That looks pretty clean. But for some reason I cannot get it working.
I don’t get an error message or so, the checkbox is simply not unchecked when clicking it.

I configured the following custom action:

Any clue what I am doing wrong?

Ah, perhaps it will only work for M:M
I’ll have a play with an example and get back to you.

I hope it also works with 1:N. Seemed a nice solution. Looking forward hearing from you Rozza. Hope you can get it working.

Sorry it seems like only M:M will take this. My presumption was that you could apply it in the same manner. Sorry for sending you the wrong way.

Why not have an M:M relationship though? Even if you don’t need it right now in the future you may have a need. You can limit students to only 1 class in other ways. Then you can add / remove them to the ‘one’ class easily without API calls and extra actions in Adalo.

You might be right. How would the add and remove actions look like through the API calls?

Thanks for your hints! Appreciated.

Forgot the API calls. You can do it via a normal update action. Remove user from class. Job done :white_check_mark:

Hi @Rozza, thanks again for your reply. The thing is that in that case you could go to class 1 and add the user and go to class 2 afterwards and add the user as well there. But there I can maybe use the M:M API call suggestion you mentioned earlier to empty the class for this student before adding him/her.