During this session, we will show you how to add a Derived Table to your Data Source and pull in those specific data points (i.e. groups, cohorts, etc.) or custom fields. You may also want to use a Derived Table to write your own SQL for your own reports.
This is an advanced topic for Zoola Analytics.
2. What is Zoola Analytics
Zoola Analytics is an award winning, cloud-based reporting and analytics solution
that allows you to prove the impact of your Learning. Zoola gives complete and
secure access to your data, stunning reports and dashboards, embedded reports,
and automated delivery. Zoola Analytics is built for Moodle, Totara Learn, and
xAPI-conformant systems.
● Complete access to all your data including custom fields and tables,
● Choose from a library of over 30 out-of-the-box report and dashboards
● Use the drag and drop designer to create your reports and dashboards,
● Embed your reports and dashboards in your LMS, or
● Schedule them to automate the delivery to your stakeholders
3. Agenda
● What is a Derived Table
○ when to use it, and
○ what are some common use cases
● How to modify a Data Source and add a Derived Table
● How to write your own SQL and use them in the Data Source
3
4. The Zoola Information Hierarchy
4
Data Connections Data Sources Ad Hoc Views Reports Dashboards
This is the definition of the connection to your database.
Only visible when you are creating Data Sources.
5. The Zoola Information Hierarchy
5
Data Connections Data Sources Ad Hoc Views Reports Dashboards
A metadata layer that provides a clean view of the
database. A Data Source allows you to control access to
the data based on security permissions.
6. The Zoola Information Hierarchy
6
Data Connections Data Sources Ad Hoc Views Reports Dashboards
An Ad Hoc view is used to explore, analyze, and
visualize the data provided by the Data Source. Ad Hoc
Views are used to create Reports and Dashboards.
7. The Zoola Information Hierarchy
7
Data Connections Data Sources Ad Hoc Views Reports Dashboards
Reports are finalized versions of Ad Hoc Views intended for
presentation and analysis purposes, allowing stakeholders
to interact with data and export the final result.
8. The Zoola Information Hierarchy
8
Data Connections Data Sources Ad Hoc Views Reports Dashboards
Dashboards combine Reports to deliver an at-a-glance and
interactive summary of information for users to view the
state of their Learning.
12. 12
SELECT d.userid AS userid,
MAX(CASE WHEN f.shortname = 'gender' THEN d.data ELSE '' END) AS Gender,
MAX(CASE WHEN f.shortname = 'state' THEN d.data ELSE '' END) AS State
FROM mdl_user_info_data d
JOIN mdl_user_info_field f ON d.fieldid = f.id
GROUP BY d.userid
NOTE :: LEFT JOIN mdl_user.id = der_uf.userid
Custom User Profile Field Query
13. 13
SELECT c.id as cohortid
, cm.userid as userid
, e.courseid as courseid
, c.name as cohort
FROM mdl_cohort c
INNER JOIN mdl_cohort_members cm ON (cm.cohortid = c.id)
INNER JOIN mdl_enrol e ON (e.customint1 = c.id)
NOTE :: LEFT JOIN mdl_user.id = der_cohort.userid AND mdl_course.id = der_cohort.courseid
Cohort Enrollment Query
14. SELECT u.lastname AS LAST, u.firstname AS FIRST, u.idnumber AS IDnumber, u.email AS
email, c.shortname AS CourseID, COUNT(l.id) AS Edits
FROM prefix_user AS u
JOIN prefix_role_assignments AS ra ON u.id = ra.userid
JOIN prefix_context AS ctx ON ra.contextid = ctx.id
JOIN prefix_course AS c ON c.id = ctx.instanceid
LEFT JOIN prefix_log AS l ON l.userid = u.id AND l.course = c.id
AND l.action NOT LIKE "view%"
%%FILTER_STARTTIME:l.TIME:>%% %%FILTER_ENDTIME:l.TIME:<%%
WHERE ra.roleid = 5 AND ctx.instanceid = c.id AND c.visible=1
AND c.shortname LIKE '%OL-%' %%FILTER_CATEGORIES:c.category%%
GROUP BY u.idnumber
HAVING Edits < 2
14
Configurable Report Query (before)
source: https://docs.moodle.org/37/en/ad-hoc_contributed_reports
15. SELECT
u.lastname AS LAST , u.firstname AS FIRST , u.idnumber AS IDNumber
, u.email AS email
, c.shortname AS CourseID
, COUNT(l.id) AS Edits
FROM mdl_user AS u
JOIN mdl_role_assignments AS ra ON ( u.id = ra.userid AND ra.roleid = 5 )
JOIN mdl_context AS ctx ON ( ra.contextid = ctx.id )
JOIN mdl_course AS c ON ( c.id = ctx.instanceid AND c.visible = 1 )
LEFT JOIN mdl_logstore_standard_log AS l ON ( l.userid = u.id AND l.courseid = c.id
AND l.action NOT LIKE "view%"
AND (from_unixtime(l.timecreated) BETWEEN
TIMESTAMP('2018-06-01 00:00:00.000') AND TIMESTAMP('2019-06-01 00:00:00.000'))
GROUP BY u.idnumber
HAVING Edits < 2
15
Configurable Report Query (after)
18. Sign up for our monthly
Zoola Analytics Newsletter
https://go.lambdasolutions.net/subscribe-to-the-zoola-newsletter
18
19. Lambda Lab: How to Use Assignment Rubrics to Drive Learning Outcomes
● Tuesday June 25, 10am PT
Master Class: Marketing Your eLearning
● Tuesday July 9, 10am PT
19
Upcoming Sessions