Hello,
I’m using the cellEdited event to capture boolean values from a table. When I check or uncheck the boolean cell in the table it returns true or false. I would like to get the bool/int value, but when I run something like:
print int(event.newValue)
I get an invalid literal for int error. Is there a way to convert the value coming from the modified cell to a boolean?
Thanks
The data type for that column in your dataset is a string. If it is an integer or boolean it will work just fine. To find out for sure click on the dataset viewer on the data property. Click on the column with the boolean value and you will see at the bottom that the datatype is a string.
You have two options:
- Convert that column to a boolean or integer. You may have to do that in your SQL query.
- Use the following script:
value = event.newValue == "true"
print value