Question: relations

Hi,

I have a question about related records in the database.

I have a table “travel_requests”, with two 1:N relations, to the tables “travelers” and “flights”. I have one object and two lists on my page. The object is the travel_request, and the two lists are related flights en travelers.

How do I create those relations succesfully? I have tried creating all the records and then linking them together like this:

However, it does not link the traveler to the flight request:

image

I think I’m doing exactly what is shown in the " Saving data in the database" lecture on youtube. Who can help?

Hello @Michiel_Prins1

Seems like your logic is correct, so the issue might be with input data.
Do the travelers and flights created in their tables?
Try to add Print blocks between this API block to see middle result.

Regards, Vlad

For now I’m only trying with travelers, but yes the travelers are created.

Printing in between shows the records. The database however doesn’t create the link.

do you see any errors in the browser’s dev console?

could you please describe steps on how to reproduce the problem from my side (which page/component/handler_name/etc.)?

Sorry I mixed up my topics :slight_smile: deleted my previous reply.

There are no errors in the console. The saving occurs in the OnClick event of Button 5, which is the “Send Request” button in the upper right corner.

But that function does not work now, because of my other topic…
Edit: other topic solved, the button should work now, so you can try why travelers are not saved.

To add a traveler, just enter a letter in the “Enter traveler name” field and click a name.

I don’t know what I have exactly done, but exactly the same code does succesfully create a relation now. Maybe the error from my other topic was in the way.

Maybe the error from my other topic was in the way.

Yes, it could be.

I’m glad that it works for you now.

Regards, Vlad