KeyError with SQL Query

A KeyError means that you are trying to access a key of a dictionary that does not exists. You say that it is happening during your system.db.runUpdateQuery - what do you see if you print the checklist right before that? I would expect you won’t see a key with ‘lastanswerid’.

Also unrelated but you might want to use system.db.runPrepUpdate query, use the keys of your dictionary to populate the columns and the values for the query values. This way you won’t have to worry about adding quotes around your arguments or formatting datetimes etc (as long as you use java datetime objects).

2 Likes