For anyone else watching - being sorted in PM and will post a précis here when concluded for others to reference.
Basically :
a=app_tables.furniture.search(
furniture_type=app_tables.furniture_types.get(
furniture_type_name=typename
)
)
furniture[‘furniture_type’] is a many-row link to furniture_type table and therefore cannot be directly compared to the row. Converting this link to a single row fixes the issue but not confirmed yet as to whether this solves the OP’s problem.
Also, Pandas is a bit of overkill (I think) - you can just do :
return len(a)
as “a” will be an array of results.