Custom SQL Reports + Choice

Custom SQL Reports + Choice

by Jonathan Lowe -
Number of replies: 4

Hi All

a number of my courses are finished with a simple yes or no choice activity at the end of the module. 

How can I include this data into the custom SQL Reports? I have a report that gives me results of all my "quiz's over my site, I just need to be able to report on what each user answers to the "choice" questions. 

 

Many thanks

Average of ratings: -
In reply to Jonathan Lowe

Re: Custom SQL Reports + Choice

by Randy Thornton -
Picture of Documentation writers

Hm, yes, there doesn't seem to be any reports for Choice. So I just crufted up a simple one:

SELECT c.shortname AS course, u.username, h.name as question, o.text AS answer
FROM prefix_choice AS h
JOIN prefix_course AS c ON h.course = c.id
JOIN prefix_choice_answers AS a ON h.id = a.choiceid
JOIN prefix_user AS u ON a.userid = u.id
JOIN prefix_choice_options AS o ON a.optionid = o.id

It shows the course, username, choice name and answer chosen by the user.

Tested in 2.5 with latest CR.

I'll add this (and any updates to it) over in ad-hoc reports in the Activities section.

- Randy

Sample of Choices report

 

In reply to Randy Thornton

Re: Custom SQL Reports + Choice

by Jonathan Lowe -

Thanks Randy. 

My courses run a mix of "Choice" options and general Quiz's. 

 

Is there a way I can run a report that will give me both quiz and choice answers on the same report? 

 

Ideally it would be great if the user skipped any questions if that was shown on the report as a blank. 

 

 

In reply to Jonathan Lowe

Re: Custom SQL Reports + Choice

by Randy Thornton -
Picture of Documentation writers

It's perfectly possible to write a query like that, but would require some work to do when combining two wholly different activities like that. Until someone does that, doing an export of two separate queries to spreadsheet will give you the data to manipulate.

 

In reply to Randy Thornton

Re: Custom SQL Reports + Choice

by Jonathan Lowe -

thanks Randy

If someone feels like combining the two that would be very handy;. We would use the resulting report to give a single "Certificate" over the entire course to show users what they had completed already.