Adding multiple values to foreign key column

What I’m trying to do:
I have an application, where I store ingredients which have one too many relationship to supermarket products.


n order to add the connections, I have created a separate adding form which I alert from the main form. There the user can add new matches to a selected ingredient and when closed it returns the list of added matches. I would like to add those matches to the repeating panel after the form closes
image

What I’ve tried and what’s not working:
I have been using a similar approach as shown in this tutorial:

However, I can get it to work when I add only 1 item, but when I add more than 1 the items in the list convert from ‘anvil.LiveObjectProxy’ to ‘list’ and can not be displayed on the screen. I have been trying different set up for over an hour, but nothing seems to work. I am sure, that I am missing something

Here is my app, the code for this is in the AddingForm and in RowTemplate1:
https://anvil.works/build#clone:FCCQXIGBTQEODQIJ=WM2YZAYIF3VMQCAZ5BRR4DVO

I think more details would be helpful here. Some more code snippets and print statements that specifically highlight the problem.

The clone link you’ve provided is fairly large and difficult to decipher the types of the data you’re trying to work with. It’s always a good idea to provide a clone link that has the minimum code needed to demonstrate the issue.

Hello,

My problem comes here


As you see I have a list of added_matches, which are LiveObjectProxy(row from the repeating panel) objects and I pass this list whenever the alert is closed. However, it only works if I return one object and not a list of objects, whenever I add the LiveObjectProxies to a list, they are converted to a ‘list’ object and it throws an exception. Here are screenshots:

image

Have you tried?

l = self.repeating_panel_1.items + matches_added
1 Like

Thank you, I was trying so many complicated ways to do it, but haven’t thought of that.