I am working with a form that has a data table in it like :
In the form I am calling the server module when the search button is pressed and passing the text of the search field :
self.repeating_panel_1.items = anvil.server.call('search_truckloads',self.text_box_search.text)
in the server module I have this :
@anvil.server.callable
def search_truckloads(query, **event_args):
thisuser=anvil.users.get_user()
thislocation=thisuser['defaultLocation']
if thislocation is None:
result = app_tables.truckloads.search()
else:
result = app_tables.truckloads.search(CRCWarehouse=thislocation)
if query:
result = [
x for x in result
if query in x['inboundREF']
or query in x['outboundREF']
or query in x['Carrier']
or query in x['DriverName']
]
return result
It will return a result when there is no value in the field (thus query is empty so it skips the for ‘x for x…’
When I have a value in the field, it throws :
TypeError: ‘NoneType’ object is not iterable at [ServerModule1, line 20](javascript:void(0)) called from [ServerModule1, line 19](javascript:void(0)) called from [Home, line 40](javascript:void(0))
I have done a pprint(result) right before the referenced line and it shows :
<LiveObject: anvil.tables.SearchIterator>
what am I missing?
what am I missing