Moodle Question Bank Import

Moodle Question Bank Import

by Pawan Churiwal -
Number of replies: 5

I am trying to import question bank from a blackboard format. Import works fine; however, after importing it changes the order of questions. In other words, import does not maintain the same order of the questions as in the blackboard file format. 

Here is the screen shot after I click on import:



After this I click on continue button and the next screen shows completely different order of questions as shown in the screen shot below:


Any help will be greatly appreciated. Thanks!

Average of ratings: -
In reply to Pawan Churiwal

Re: Moodle Question Bank Import

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
The question bank lists questions by question type, then alphabetically by name. If you want a particular order, try renaming the questions so the names start 01, 02, 03, ...
Average of ratings: Useful (2)
In reply to Tim Hunt

Re: Moodle Question Bank Import

by Pawan Churiwal -
Thanks, Tim, for your reply. Is it possible that I turn off default sorting feature of Moodle or deploy some extension which allow me to keep the original order? As can be seen in the screenshot that I posted previously when I click on the Import button, questions do import in the order in which it is in the input file. However, clicking on clicking on continue changes the order.
Editing each question will be a massive task; therefore, I am trying to find a way which is automated. Many thanks for your help.
In reply to Pawan Churiwal

Re: Moodle Question Bank Import

by Eoin Campbell -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Prefixing question names with a number in bulk is slow and tedious within the Moodle interface, but you could either do it before you import the questions, if the Blackboard import format is plain text, or else export the Moodle questions to a file in text format such as XML and do it afterwards. In the XML file, search for the "<name>" element and then add the number in the "<text>" element below it. For 100 questions, this wouldn't take very long.

<question type="multichoice">
    <name>
      <text>001. Question name</text>
    </name>

If you're feeling brave, and have a lot of questions, you could export to a Word file using the WordTable plugin , and then auto-number the "Heading 2" styles in Word to add in zero-padded numbers like 001, 002 (cf. Number your headings ). The Heading 2 styles contain the question names. Then run a simple VBA command to convert the generated numbers into text values, see Converting Automatic Numbering to Manual Numbering. This will make the numbers a part of the question name text. Finally, import the questions back into Moodle directly from Word.

This approach is probably only suitable for large batches of questions that don't contain images.

Average of ratings: Useful (2)
In reply to Eoin Campbell

Re: Moodle Question Bank Import

by Pawan Churiwal -

This is very helpful and works. However, I am exploring one additional idea. Moodle has a field called "ID number" which can be used to sort the questions. If I can create an "ID number" field and populate with 001, 002, etc. in the XML file, that would be great. I do not know how to create this field in the blackboard "questions.dat" xml file. Any help would be huge. 

See below the screenshot for the ID number field:

 


I have also included the blackboard.zip file if that is going to be helpful. 

Many thanks to everyone for your tremendous help.

In reply to Pawan Churiwal

Re: Moodle Question Bank Import

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
As far as I know, the ID Number cannot be used for sorting. The little "?" suggests its purpose.

I think that you just need to put a number in the Question Name, and not in the Text of the question.

If I were doing this, I would enter the 001 in only one question, then export the entire set as XML, then open the XML file, note what my change did, and repeat this for every other question. This process would be following the advice that Eoin provided. If I had a bunch of these to do, I would use MS Word's mail merge feature for autonumbering. If you just have a few, it would probably take you longer to figure out Word's mail merge than just manually making the changes.
Average of ratings: Useful (1)