Multiple Categories Option News Aggregator Demo

So I’m coming back to using Anvil after being gone for a year or so. I’m working on picking back up on a application I am building and using Anvil to do it.

The https://anvil.works/learn/tutorials/database-backed-apps/chapter-4 was a great way to get back up to speed on things, my only question with the setup of this how would you do multiple categories the same way? When I tried it with the same setup I’m getting:

anvil.tables.TableError: Column 'categories' is a liveObjectArray - cannot set it to a Row from 'categories' table

Just curious, I’m sure I would have to somehow get the options selected out of this but looking at the object I don’t know how to do this, if anyone knows or has doc links to point me to would be appreciated.

My guess is I have to get the list of categories via something like categories = article_dict['categories'] then add it as a list like [categories] when adding the data.

Thanks

I haven’t looked at that tutorial but in general the live object array is similar to a list (in that it is a container).

That is, a column that uses multiple row links can only be set/updated by passing a list-like object.

For example, if you want to add a row to the table containing the multi-link, and add multiple rows inside the multi-link column, you could do:

list_of_rows=[r for r in app_tables.table_1.search(name='bob')] 
app_tables.table_2.add_row(multi_link=list_of_rows)

Here is a clone to demonstrate that you can play around with:
https://anvil.works/build#clone:QNYUEFBSBOZH3CPS=AT4NMOAQGN4OMKDIW7F4QAWU

thanks I figured from playing around with it after writing this it was something like that.