Ad-hoc database queries

Reports ::: report_customsql
Maintained by TimTim Hunt, at the OU (Perry building)Mahmoud Kassaei, Anupama Sarjoshi
This report plugin allows Administrators to set up arbitrary database queries to act as ad-hoc reports. Reports can be of two types, either run on demand, or scheduled to run automatically. Other users with the right capability can go in and see a list of queries that they have access to. Results can be viewed on-screen or downloaded as CSV.
Latest release:
4572 sites
1k downloads
177 fans
Current versions available: 10

This report, created by The Open University, lets Administrators set up arbitrary SQL select queries that anyone with the appropriate permissions can then run. Reports can be set to be runnable on-demand, or automatically run weekly or monthly.

The results are displayed as a fairly plain HTML table, and can also be downloaded as CSV.

The idea is that this lets you quickly set up ad-hoc reports, without having to create a whole new admin report plugin.

Screenshots

Screenshot #0

Contributors

Tim
Tim Hunt (Lead maintainer)
at the OU (Perry building)
Mahmoud Kassaei: Developer
Anupama Sarjoshi: Tester & Developer
Please login to view contributors details and/or to contact them

Comments RSS

Tampilkan komentar
  • Character Academy Academy
    Sab, 20 Apr 2024, 12:21
    Hi Tim,
    Thank you for building this plugin. It really is a great tool and it's easy to use. In an attempt to contribute what little I can to the ongoing development of this project - I found a little update to one of the reports I can share.

    As written on https://docs.moodle.org/403/en/ad-hoc_contributed_reports - There is outdated table name reference in the report "User activity completions with dates"
    Moodle used to have a module called 'assignment' which has since been replaced by 'assign'. Once that table reference is renamed everything else works fine senyum

    Apologies if if this isnt the appropriate place to share this, but I couldnt find anywhere else to put this. I hope this helps keep the project fresh, and once again thanks for your effort here. Cheers!
  • Tim
    Sen, 22 Apr 2024, 15:54
    Thanks for thinking of contributing back. docs.moodle.org is a wiki. You can edit it yourself senyum
  • Hoda Askar
    Sel, 28 Mei 2024, 21:01
    Hi Tim,

    Could you please advise if this plugin will be compatible with 4.1, 4.2 and 4.3?

    Best,
    Hoda
  • Fabian Glagovsky
    Rab, 17 Jul 2024, 17:22
    Hi Tim,
    Sorry to bother, but I see the plugin it compatible only up to Moodle 4.0. Is it compatible with Moodle 4.3?
  • Tim
    Rab, 17 Jul 2024, 20:32
    The latest code in github works with 4.3. (I am working to publish the latest code here too, but there are only so many hours in each day.)
  • Fabian Glagovsky
    Min, 21 Jul 2024, 15:03
    Thank you Tim!
  • David Lowe
    Rab, 14 Agu 2024, 03:32
    If I want to create a report that looks at students in a course doing stuff in the first week while also having a subquery that's looking in the standard_log table (timecreated) I end up with multiple date inputs when I only need 1.
    Is there anyway to use the same variable multiple times with one input?
    Thanks.
  • Avon Blyth
    Sen, 9 Sep 2024, 22:44
    I am having an issue with a report designed to be run by end users.

    The reports get data based on the current user %%USERID%%. Most of the time the reports work fine, however if two users run the same report at the same time, it displays both users data to one of the users.

    I have tested this by creating a basic SQL query then have two users access it at the same time.

    This is the query used for testing:

    SELECT u.firstname
    FROM {user} u
    WHERE u.id = %%USERID%%

    This results in one of the users getting two names, and the other just getting their name.

    Is there any thing I can do to prevent this, anything I am doing wrong, or is this a bug?
  • Fabian Glagovsky
    Sel, 17 Sep 2024, 16:03
    Hi Tim, is there anything we can do to have this plugin certified for Moodle 4.3+ here?
    Best,
  • Robert Wagenhoffer
    Min, 3 Nov 2024, 22:05
    Hello,

    Just upgraded to Moodle 4.5 and noticed a cosmetic error with this plugin. Looks like Moodle use to use small little diamond arrows next to each category that could be expanded. With this upgrade, these diamonds are now black arrows. However, on this plugin the arrows are way to large and it looks terrible. If anyone is still maintaining this app, please take a look at this when you have time. thank you.
  • Michael Milette
    Sel, 19 Nov 2024, 23:23
    Good day, I was wondering, when do you think we can expect to see a release of this useful plugin for Moodle 4.5 LTS?
  • Motasem Al Haj Ali
    Sel, 19 Nov 2024, 23:43
    This plugin has been very useful for us at DCU, and it would be great if we could continue using it.
  • Giovanni Mancini
    Kam, 5 Des 2024, 17:17
    Hi

    I updated the plugin to the latest version and I have this error, already displayed in the past
    PHP deprecated: the strftime() function is deprecated in /var/www/vhosts/sedex.formazionelavoratori.online/httpdocs/report/customsql/locallib.php at line 611

    Versionephp 8.1.30
    Moodle 4.5+
  • Michael Milette
    Rab, 25 Des 2024, 18:51
    Hi Tim, when do you think we might be able to see a release compatible with Moodle 4.5 (LTS)?
  • JC
    Sel, 4 Mar 2025, 20:03
    I have installed the plugin in a moodle 4.5 with php 8.3 and it went smooth.
    Just a super minor cosmetic issue in the category list of queries.
Please login to post comments