Find repeating panel count of items?

I have a textbox where I can enter a text to search if it exists in the database and if so display the result(s) in the Datagrid repeating panel. It is working correctly.

I want that if I enter a text that it checks if the text can be found in the database (so far ok)

  • but if no result, check the same entered text.capitalize()
  • if still no result, check the same entered text. upper()
  • if still no result, check the same entered text. lower()

Therefore how can I check that the result is none?
Can I find the number of repeating panel items of the search result?

server-side code
@anvil.server.callable
def search_comp(query):
result = app_tables.component.search(tables.order_by(“KTnr”, ascending=True))
if query:
result = [
x for x in result
if query in x[‘KTnr’]
or query in x[‘Mftnr’]
or query in x[‘Mft’]
or query in x[‘Description’]
or query in x[‘Place’]
]
return result

client-code example:
def search(self, **event_args):
captext = self.txtbox_search.text
self.repeating_panel_1.items = anvil.server.call(‘search_comp’,captext)

Your result is a list. Use the standard Python method len(result) to get the number of items in the list.

2 Likes