Cannot update a relationship

Hi there,

I have the following simple list which updates a student:

After I save it I want to update the 1:1 relationship with his/her chatroom, so that the chatroom also knows about the updated/changed class:

For some reason it’s not saving this. Am I doing something wrong?

Thanks so much for helping me out or pointing me in the right direction. :pray::pray:

Hello, there are 3 types of relationships between collections :
1- One to many.
2- Many to One.
3- Many to Many.

*A 1:1 is not available in the relationship types. Please recheck your database relationship between collections and their types.

Thank you!

You‘re right. It‘s a many to one actually. A student has one class and a class has many students.

Yes exactly.

Ok, good that that’s clear. Question is still what I am doing wrong.

  • I am using a simple list to update a student (including the class field).
  • Afterwards I update his/her chatroom (n-1) with this class field as well.

For some reason this second step isn’t done/saved?
Suggestions for debugging would also be very welcome. Thanks in advance for any help. :pray:

Please check if the (current class) was created and it’s not an empty field, and is being transferred between screens.

Hi Ali-Bazzi, thanks again for thinking with me. I’ve checked what you said. The funny thing is that the second time I save the student, it updates the chatroom information. It feels like the “update Chatroom” is too fast after the “update Student” action, so that it doesn’t know yet that the student is updated.

Ok, I gave it another try by simplifying it further and creating a custom form. Just to understand what’s going on.

The screen is called ‘Edit Student’ and the information from a Student comes in as available data:

A student has the following fields:

I’ve created the following custom form that looks like this:

In preview it renders nicely:

I’ve created the following ‘Update Student’ action behind the save button:

Hitting the button does update the fields in the table (collection) of the student itself (name, birthdate), but doesn’t update the relations with the ‘gender’ or ‘class’.

I don’t understand what I am doing wrong? Any help is highly appreciated. Thank you! :pray:

Still looking for help here. I don’t get why the class is not updated in the Chatroom collection?
Thanks for putting some brainpower into this. It’s highly appreciated.

Eventually @dilon_perera helped me with this (Thanks Dilon :pray::pray::pray::pray:).

It appeared that if you use a default form to update a component and you want to do actions afterwards, with the supposed updated values of the first component, it still takes the previous (old) values.

Dilon changed the default form to a custom form (separate fields and button) and then did update actions to update the different components with the values straight from the fields. That did the trick.

Hope this is helpful for others as well.

1 Like