Add fields to this activity completion report

Re: Add fields to this activity completion report

by Randy Thornton -
Number of replies: 2
Picture of Documentation writers
Kathryn,

To do 2), remove a field, you can either put a pound sign # in front of the lines to comment them or, or you can simply delete them. Each column of the report is separated by a comma in the SELECT statement. So put a # in front of the start of the column logic you wish to remove.

If you want to add other fields related to users, then you need to know the names of those fields, which are: u.firstname, u.lastname, u.email, u.institution. The names of the user fields here are the very same ones used in other places such as the user upload field. They are standard names.

You can add those in any place you want between the word SELECT and the keyword FROM - those are define the columns in the order you want. Just make sure there is a comma between each one.

So,

u.username, u.firstname, u.lastname, u.email, u.company, u.institution

is the same as

u.lastname, u.firstname, u.institution, u.company, u.email, u.username

but the order is different. You can order them any way you wish, include or exclude the ones you wish. You will find many examples of these over in the Ad-hoc reports page.

Good luck & watch your commas...

Randy
Average of ratings: Useful (1)
In reply to Randy Thornton

Re: Add fields to this activity completion report

by Aarthi Ramesh -
Thanks for the question, Kathryn, and for your helpful response, Randy!
On the above report, I would like to see a column that captures the actual completion hours for each activity...so the actual time (in hours) the student took to complete the activity. I am not sure which value captures that information in the database to bring it into the SQL query. My company is also using Moodle 3.6. Is there a schema diagram available for me to identify that info?
Thanks!
In reply to Aarthi Ramesh

Re: Add fields to this activity completion report

by Shirley Gregorczyk -
Picture of Particularly helpful Moodlers
If you use the SQL plugin, on the Custom SQL tab have a link Custom SQL at the bottom of the page.
Select that link to open a pop-up. The Pop-up includes the link to the Database schema. That link has all of the Moodle versions listed.
Database schema