Fix to Data Bindings Tutorial for Year

**When running the Data Bindings Tutorial (clone), I get the following error when editing the year:

anvil.tables.TableError: Column ‘year’ is a number - cannot set it to a string site:anvil.works

**

The following fixes this:

Code Sample:

# this is a formatted code snippet.
# paste your code between ``` 
    movie_data['year']=int(movie_data['year'])
    row.update(**movie_data)

Clone link:

Welcome to the forum!

If you set your input type for that text box to number (in the properties panel for the text box), then it’ll come through as an int rather than a str.

1 Like

Thank you!

By way of introduction, for the last three years, I have been teaching Secondary Computer Science in London- this is after many roles in Technology.

I am getting up to speed on Anvil this month to introduce it to my A-level students for their computing projects. Currently, they are using the Tkinter and SQLite3 libraries in Python, but I think they should be far more productive on Anvil.

I flagged this glitch because I got an error running the Tutorial solution. Is this forum the best place to flag issues? If not, where should I provide feedback?

3 Likes

This is the right spot to flag those sorts of things. The tutorial should have talked about setting the input type for the year field text box. That switch from the text box giving back a number vs a string isn’t obvious, but is important especially to get the right keyboard on mobile devices.

I’ve had good luck using Anvil with students, hopefully yours have the same great experience.

3 Likes