SCORM scoid for activity - Moodle 3.4

SCORM scoid for activity - Moodle 3.4

by T K -
Number of replies: 5

It's me again, yes I have been working on getting this SCORM moving on our server!

When I hover on the scorm activity, i see this link, which means the scoid is 2830? Am I right?
xxx/mod/scorm/view.php?id=2830


However for the life of me, I can't seem to find the number in the mdl_scorm_scoes table, even though the column scoid is there, this number does not exist!

scoesdata

Please help, seems like i am not looking at the right place.

Thanks!

Average of ratings: -
In reply to T K

Re: SCORM scoid for activity - Moodle 3.4

by Benjamin Ellis -
Picture of Particularly helpful Moodlers
Me again too smile That is because that is the course module ID and that can be found in the 'mdl_course_modules' table. The instance field will be the id of the module of the module specified in the table's module field (also by id). The modules's id, in your case, scorm is found in the 'mdl_modules' table.
Average of ratings: Useful (1)
In reply to Benjamin Ellis

Re: SCORM scoid for activity - Moodle 3.4

by T K -

mdl_modules

Hi Benjamin, thanks for your reply. Above is the mdl_modules, how to see the scoid?

In reply to T K

Re: SCORM scoid for activity - Moodle 3.4

by Benjamin Ellis -
Picture of Particularly helpful Moodlers

FOR xxx/mod/scorm/view.php?id=2830

2830 is id in mdl_course_modules
    field module = field id in mdl_modules (scorm = 18)
    field instance = field scorm in mdl_scorm_scoes
Usually you will have 2+ records in mdl_scorm_scoes - one will be the root (blank launch field) and then the others are the 'launchable' scoes.


SELECT mdl_scorm_scoes.id AS scoid
FROM mdl_scorm_scoes
JOIN mdl_course_modules ON mdl_course_modules.instance = mdl_scorm_scoes.scorm
WHERE mdl_scorm_scoes.launch <> ''
AND mdl_course_modules.id = 2830

Average of ratings: Useful (1)
In reply to Benjamin Ellis

Re: SCORM scoid for activity - Moodle 3.4

by T K -
OH i see it now, thanks so much Benjamin!

One more thing if you dont mind, I have this sql query question. I am trying to query a table with all the grades & completion status for scorm. The query keeps failing at the bolded line as below, if i run with without the bolded line, it runs just fine. 
I've been reading about the subselect, and i cant seem to figure out what is wrong in the syntax here:

SELECT
mdl_course.idnumber as course_id,
mdl_course.shortname,
mdl_course.category,
mdl_user.id as moodle_id,
mdl_user.username as "NRIC/Passport",
mdl_user.firstname,
mdl_user.lastname,
mdl_user_info_data.data as employer_id,
mdl_scorm.name as scorm_name,
status = (SELECT mdl_scorm_scoes_track.value where mdl_scorm_scoes_track.element='cmi.core.lesson_status'),
mdl_scorm_scoes_track.attempt,
 from_unixtime(mdl_scorm_scoes_track.timemodified) as completiondate,
    'scorm' as lessontype
FROM mdl_scorm_scoes_track
INNER JOIN mdl_scorm
        ON (mdl_scorm.id = mdl_scorm_scoes_track.scormid)
        INNER JOIN mdl_user
ON (mdl_scorm_scoes_track.userid = mdl_user.id)
        INNER JOIN mdl_course 
ON (mdl_course.id = mdl_scorm.course)
INNER JOIN mdl_user_info_data
ON (mdl_user_info_data.userid = mdl_user.id)
WHERE ( mdl_user_info_data.fieldid=5 )

sqlerror
In reply to T K

Re: SCORM scoid for activity - Moodle 3.4

by Benjamin Ellis -
Picture of Particularly helpful Moodlers
Your are missing your FROM tablename bit

SELECT mdl_scorm_scoes_track.value FROM mdl_scorm_scoes_track where mdl_scorm_scoes_track.element='cmi.core.lesson_status