Databinding Question

The technical cause of this error is that the expression app_tables.company_info.search(Email=anvil.users.get_user()['email']) resolves to True even when the search method returns no results. But then the get method returns None (so line 43 is trying to assign something to None['Company_Name']).

More broadly, though, the reason that several folks are trying to help you by pointing you to tutorials and asking you more fundamental questions rather than giving you specific suggestions is that, to put it bluntly, a line like company_info['Company_Name'] = self.company_name_textbox.text doesn’t make any sense. I may be misinterpreting your intentions, but you seem to think that line will “pull the data and assign it to” that textbox field, but its actual meaning is the reverse: to pull from the textbox and assign that value to the data table field. In any case, such a line is redundant to the data binding that already connects that textbox to the data table field. So your code seems to reveal a lack of understanding of how this stuff works. You may need to take a step back and do some Python/Anvil learning before returning to building your app.

My suggestion is to work slowly through one of the tutorials others have pointed you towards, fiddling around with it and looking up things in Python and Anvil docs to make sure you understand what’s going on. Then try it out from scratch in a simpler version of your app–remove all the other stuff and just try to get data binding to work on a single text box (something like the example app @nickantonaccio has kindly provided for you)–and get that working. Then return to your more complex app and implement it there.

4 Likes