How to fix: “Cannot find the data record in database table question_multichoice”

0
3218

warning_blackI use GIFT format to import most of the question banks that I create or acquire from other sources. It’s a great, easy to use way to add lots of questions to Moodle very quickly. One word of caution though is that before you upload a file you should check your GIFT file in a text editor like Notepad++ to ensure that there are no strange characters included which can cause an error that will stop your import altogether or give you and your students trying to attempt an exam and error such as

 

Cannot find the data record in database table question_multichoice

So, what’s a strange character and how do you fix that error?

  1. strange characters to Moodle captured in a text editor are mostly punctuation: dashes, commas, quotation marks which, if copy and pasted from Word or the web might look correct but are in fact not the plain-jane versions of the punctuation of what you want and Moodle expects to receive in an import file. If you encounter that error what could have happened is that one of your questions or question answers included a strange character. You might have seen the import process stall on a specific question but not thought anything of it, added the remaining questions and created your quiz. Now when trying to access that quiz the error displays because the import process stalled in the middle of a question importing only the question text but no answers (creating an item bank that basically cannot exist).
  2. how do you fix it? for any quiz in question where this error is displayed upon trying to preview or attempt it, open the category of questions and review the items one by one using the preview icon. At some point you’ll find a question that shows the same error. Delete it, recreate it in the same category, and voila: all fixed and functioning once more.

One thing that I try to do before every import is try to review the text file for special characters looking specifically at the punctuation marks and do a quick find and replace for any that might have carried over from the source of the questions incorrectly.