I can’t work out how to fetch related data from a linked table.
table1 has a text column (“Name”) and a link to a single row from table2 (“Status”) which has 2 possible text values, Enabled & Disabled.
table1 data was entered via the IDE and the linked data was selected from a popup radio button choice.
I have two server side functions -
@anvil.server.callable
def fetch_all_switches():
return app_tables.switches.search()
@anvil.server.callable
def fetch_switch_status(id):
row=app_tables.statuses.get_by_id(id)
return row
I call the first one -
switchlist=anvil.server.call('fetch_all_switches')
for s in switchlist:
At this stage, s[‘Name’] has data. As I cannot print s[‘Status’] I assume it is a reference ID into table2 (“Statuses”) so I try -
status=anvil.server.call('fetch_switch_status',row['Status'])
but the returned value is not usable as far as I can see.
How do I get that linked data?