New plugin: Custom reports

New plugin: Custom reports

by Juan Leyva -
Number of replies: 215
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

This is a block I've developed in my spare time (since one year ago).

This post is a call for volunteers. I need volunteers for testing the block before release a first version in the plugins database.

This block is a Moodle custom reports builder.

It is designed in a modular way to allow developers to create new plugins in less than an hour.


What type of reports can I create?

- Courses reports, with information regarding courses.

- Users reports, with information regarding users and their activity in a course.

- Custom SQL Reports, custom SQL queries. This block can use the same SQL queries that Tim Hunt's Custom SQL queries plugin.

Note for developers: You can create your own type of reports.


Who can view the reports?

When you create a report you can select which users can view it.

Links to reports are displayed in a block in the course or site frontpage.

 

Downloadhttp://tracker.moodle.org/browse/CONTRIB-2386 (It is the first attachement)

Documentation: http://docs.moodle.org/en/blocks/custom_reports/

Feedback and new plugins requests are welcome.

Screenshots:
http://docs.moodle.org/en/images_en/thumb/4/4c/block_custom_reports_sample_user_report.png/600px-block_custom_reports_sample_user_report.png

http://docs.moodle.org/en/images_en/thumb/1/1c/block_custom_reports_sample_sql_report.png/600px-block_custom_reports_sample_sql_report.png

 

Average of ratings: -
In reply to Juan Leyva

Re: New plugin: Custom reports

by Luis de Vasconcelos -

Thanks Juan. It looks great. I'll give more feedback once I've installed it.

In reply to Luis de Vasconcelos

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

I've upload a new version of the plugin with a bug in versions prior to 1.9.9 fixed

Thanks Luis for your feedback

Regards

In reply to Luis de Vasconcelos

Re: New plugin: Custom reports

by David Warren Ruiz -

Hola Juan:

TEngo instalado Moodle 2.6 y usa una base de datos en otro servidor con Postgres. Instale el plugin y no tuvo ningun problema, paro al generar el reporte me regresa este error:

Debug info: ERROR: function from_unixtime(bigint) does not exist
LINE 13: DATE_FORMAT(FROM_UNIXTIME(user2.lastaccess),'%Y-%m-%d')) AS ...
^
HINT: No function matches the given name and argument types. You may need to add explicit type casts.
SELECT 
user2.id AS ID, 
ul.timeaccess, 
user2.firstname AS Firstname, 
user2.lastname AS Lastname, 
user2.email AS Email, 
user2.city AS City, 
user2.idnumber AS IDNumber, 
user2.phone1 AS Phone, 
user2.institution AS Institution, 

IF (user2.lastaccess = 0,'never', 
DATE_FORMAT(FROM_UNIXTIME(user2.lastaccess),'%Y-%m-%d')) AS dLastAccess 

,(SELECT DATE_FORMAT(FROM_UNIXTIME(timeaccess),'%Y-%m-%d') FROM mdl_user_lastaccess WHERE userid=user2.id AND courseid=c.id) AS CourseLastAccess 

,(SELECT r.name 
FROM mdl_user_enrolments AS uenrol 
JOIN mdl_enrol AS e ON e.id = uenrol.enrolid 
JOIN mdl_role AS r ON e.id = r.id 
WHERE uenrol.userid=user2.id AND e.courseid = c.id) AS RoleName 

FROM mdl_user_enrolments AS ue 
JOIN mdl_enrol AS e ON e.id = ue.enrolid 
JOIN mdl_course AS c ON c.id = e.courseid 
JOIN mdl_user AS user2 ON user2 .id = ue.userid 
LEFT JOIN mdl_user_lastaccess AS ul ON ul.userid = user2.id 
WHERE c.id=16 AND ul.timeaccess IS NULL 
LIMIT 5000 OFFSET 0
[array (
)]
Error code: dmlreadexception
Stack trace:
  • line 443 of /lib/dml/moodle_database.php: dml_read_exception thrown
  • line 243 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
  • line 706 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
  • line 77 of /blocks/configurable_reports/reports/sql/report.class.php: call to pgsql_native_moodle_database->get_recordset_sql()
  • line 122 of /blocks/configurable_reports/reports/sql/report.class.php: call to report_sql->execute_query()
  • line 69 of /blocks/configurable_reports/viewreport.php: call to report_sql->create_report()

Mi pregunta es, si debo colocar el host, la base de datos , el usuario y el password en Configuracion>Bloques>Configiurable report.


Gracias

In reply to Juan Leyva

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

The block have been renamed from Custom Reports to Configurable Reports (to avoid confussion with Tim Hunt's Custom SQL Reports plugin).

Thanks to the community feedback I have fixed some bugs, the block is available for download in the Modules and Plugins Database:

http://moodle.org/mod/data/view.php?d=13&rid=4283

Please, wait 24 hours to download it

For bugs reporting and issues request, visit:

http://tracker.moodle.org/browse/CONTRIB/component/10753

In reply to Juan Leyva

Re: New plugin: Custom reports

by Jason Hollowell -
Picture of Particularly helpful Moodlers

Juan,

This is a wonderful tool! Thanks so much for contributing it.

I've been playing with it a little and it doesn't seem to allow for the creation of reports using custom user profile fields. Am I missing something or is that currently not a part of the functionality?

And, if it's not currently a part of the feature set, how difficult would it be to add? It would be very nice to be able to create reports using fields that we have added to user profiles. smile

Thanks

Jason

In reply to Jason Hollowell

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hello Jason,

it's not dificult at all.

I will fix this in a short time, maybe today

Bye

In reply to Jason Hollowell

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hello Jason,

I have just added the new functionality you asked for

You can download the block using this link:

http://tracker.moodle.org/secure/attachment/21877/configurable_reports.zip

Regards

In reply to Juan Leyva

Re: New plugin: Custom reports

by Jason Hollowell -
Picture of Particularly helpful Moodlers

Juan,

Wow! That was fast! I will download it and give it a try. This is a wonderful tool and will allow us to aggregate all sorts of data. I'll download the newest version and give it a try.

Thanks again.

Jason

In reply to Jason Hollowell

Re: New plugin: Custom reports

by Jason Hollowell -
Picture of Particularly helpful Moodlers

Juan,

I've just been working with the newest version a bit and I see that customized user profile fields is now selectable as a column when creating a report but I can't use the fields when I want to setup conditions. Is it possible to use them for conditions as well?

Jason

In reply to Jason Hollowell

Re: New plugin: Custom reports

by Adam Hughes -

Juan,

Great plugin. I think this should replace the default reporting system that moodle includes.

I am after something similar to Jason. Is there a way to use Custom User Profile Fields in the User Field Filter?

Also, what would be the best way of displaying in a pie chart how many users have completed the course compared to how many users haven't?

Thanks for all your great work.

Adam

In reply to Adam Hughes

Re: New plugin: Custom reports

by Jason Hollowell -
Picture of Particularly helpful Moodlers

Juan,

Just a quick check to see if you have had any luck adding the custom user profile fields to the filter component of this report builder?

This is a great tool with tons of possibility and the addition of the user profile fields to the filter function will take a huge step forward for me. I know there is an ongoing issue with being able to update your contribution via CVS so maybe you are waiting that. I don't mean to rush you, just wanted to check and see how things are going with this addition.

Jason

In reply to Jason Hollowell

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Jason,

I added this functionallity yesterday, you can wait 24 hours to download again the plugin or just download these files:

http://cvs.moodle.org/contrib/plugins/blocks/configurable_reports/components/filters/fuserfield/form.php?revision=1.2

http://cvs.moodle.org/contrib/plugins/blocks/configurable_reports/components/filters/fuserfield/plugin.class.php?revision=1.3

to your components/filters/fuserfield folder

Regards

In reply to Juan Leyva

Re: New plugin: Custom reports

by Nick Thompson -

After looking at the tool a little more, there are a couple other features that would great:

Mass Export - ability to export multiple reports to excel at once instead of having to go through each one and click for each report

Export/Import the report itself - Here at UCLA we have multiple installations of Moodle, but are using the same code base.  As it is, we would have to re-create all the reports manually on both systems, but if we could export the report and create a new report on the other system via a report-import, that would be priceless.

Thanks for all your hard work on this tool Juan!

Nick

In reply to Juan Leyva

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

In the following link is available for download the last version of the block:

Notes:

- User profile fields are included in conditions and also permissions as Jason requested

- A basic print report option is included as Andreas requested

- A bug in the SQL Query on user filter (only for postgres db) is fixed, thanks to Barbara for debugging the plugin with Postgres

- The manage reports table is sortable and the default order  report's name. Thanks Luis for the suggestion

Download link:

http://tracker.moodle.org/secure/attachment/21926/configurable_reports.zip

In reply to Juan Leyva

Re: New plugin: Custom reports

by Andreas Gross -

Hi Juan,

> A basic print report option is included

this is great!

I immediately tried this new version, installed well without fault, but I can not see the difference..

How do I get the printed report?

I have tried with ctrl-p, but still the same with the menu in the header.

Do I have to use a printer.css for this, if yes, where to put that?

yours

Res

In reply to Andreas Gross

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Andreas,

at the bottom of the report page you should see a link "Print report"

This link opens a new windows with just the "main area" of the report

Make sure you are using the viewreport.php of the last version

Juan

In reply to Juan Leyva

Re: New plugin: Custom reports

by Andreas Gross -

Hi Juan,

thank you for reacting so quick! Yes, you are right, it works.

I made a mistake in uploading the files, so I was bugged.

Thank you again, for this marvelous module! This helps so much.

yours

Res

In reply to Juan Leyva

Re: New plugin: Custom reports

by Jaime Andrés Sánchez Vélez -

Hola Juan,

Estaba intentando instalar tu módulo, que por cierto me parece grandioso, pero lo descomprimo en la carpeta blocks, voy a la opción de notificaciones pero no pasa absolutamente nada.

Espero que me puedas dar una pista,

Saludos.

PD: Uso,

Moodle 1.9.9.

IIS 6.0

SQL Server 2005

Windows Server 2003

In reply to Jaime Andrés Sánchez Vélez

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hola Jaime,

descarga la última versión de aquí:

http://tracker.moodle.org/secure/attachment/21939/configurable_reports.zip

Por otro lado, desde Administración -> Servidor activa la depuración y mostrar errores por portada

Es raro que no salga ningún mensaje se instale o no

Saludos

In reply to Juan Leyva

Re: New plugin: Custom reports

by Jaime Andrés Sánchez Vélez -

Gracias por la respuesta,

Ya he hecho lo que me dijiste de activa la depuración, pero aún así no se muestra ningún mensaje en cuanto entro a Notificaciones.

De todas maneras el problema no parece ser propio de tu plugin, ya que con todos me pasa lo mismo :S.

 

Saludos.

In reply to Juan Leyva

Re: New plugin: Custom reports

by Sarah Phillips -

Hi Juan,

 

This is a great block, i have been trying to find something that reports student enrolments by course and time frame, eg the month of November.

I seem to be having trouble figuring out which fields i am meant to use to do this. We use third party content for our delivery and need to report on the time that each student enrols in a particular course.

Would you be able to help me with my query, as i am not good with sql and only moodle when i get a chance.

Thanks,

Sarah

In reply to Sarah Phillips

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Sarah,

please, import the attached xml file (in the manage reports page, use the import report option)

It's a SQL report with a couple of filters (course and dates), I think that is what are your looking for

Juan

In reply to Juan Leyva

Re: New plugin: Custom reports

by Jaime Andrés Sánchez Vélez -

Hola Juan,

Por fin tengo el plugin funcionando! :D

Ahora quisiera extender la funcionalidad el plugin. Me he dado cuenta que en los reportes tipo sql no puedo agregar filtros de campos del perfil de usuario. Lo solucioné modificando una línea en la clase del plugin:

$this->reporttypes = array('users','sql');

Ahora me sale y puedo agregar el filtro, pero cuando ejecuto el informe (sin modificar el SQL) me saca éste error.

Fatal error: Call to undefined method report_sql::get_all_elements() in C:\Inetpub\wwwroot\moodle_xm\blocks\configurable_reports\report.class.php on line 295

Me puedes ayudar, cómo puedo hacer para agregar más filtros.


Gracias.

In reply to Jaime Andrés Sánchez Vélez

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hola Jaime,

para conseguir que el filtro de usuarios funcione en el informe SQL hay que hacer más  cambios que lo que has hecho por ahora.

Debes fijarte en un filtro ya implementado para el informe SQL, como por ejemplo, el de cursos y hacerlo de forma equivalente para usuarios.

Debes tener cierto dominio de PHP y conocer también la estructura de base de datos de Moodle y algo de programación en la plataforma.

En mi lista de cosas a hacer está este filtro también, no te puedo indicar para cuando lo podría tener.

Saludos

In reply to Juan Leyva

Re: New plugin: Custom reports

by Jaime Andrés Sánchez Vélez -

Hola,

Pues exactamente eso es lo que he hecho :P, he duplicado el filtro de cursos para que funcione con usuarios, así el usuario puede seleccionar un usuario de una lista desplegable para filtrar la consulta. También he creado uno para un campo de texto abierto y que en la consulta se busque por medio de un LIKE.

Si te interesan las carpetas de esos 2 filtros, mi correo es jasv.riot@gmail.com.

Saludos.

In reply to Juan Leyva

Re: New plugin:Custom reports for Oracle

by chandrika harathi -

Hello Juan,

I have Oracle  11g and get the following error when I try to install. The change from mySql to Oracle  If I have a sequence for ID and set default for datetime for timemodified. I should be able to re-write the create statements.

I get the same error/complaint for all the table-create.

Anything else I need to check other than create stmt?

Thanks,

Chandrika

 

907: ORA-00907: missing right parenthesis

         ADOConnection._Execute(CREATE TABLE m_manual (  id int(10) unsigned NOT NULL auto_increment,  course int(10) unsigned NOT NULL default '0',  name varch..., false) % line  775, file: adodb-oci8.inc.php
    ADODB_oci8.Execute(CREATE TABLE m_manual ( id int(10) unsigned NOT NULL auto_increment, course int(10) unsigned NOT NULL default '0', name varch...) % line 89, file: dmllib.php
  execute_sql(CREATE TABLE m_manual ( id int(10) unsigned NOT NULL auto_increment, course int(10) unsigned NOT NULL default '0', name varch...) % line 235, file: dmllib.php
modify_database(/apps/zend/apache2/moodle/mod/manual/db/oci8po.sql) % line 392, file: adminlib.php
upgrade_activity_modules(http://msutmoo01.umdnj.edu/admin/index.php) % line 433, file: index.php

In reply to Juan Leyva

Re: New plugin: Custom reports

by karim faid -

Hi Juan:

Very nice plugin! I played a little bit with it and tried to embed some columns from one report into another. This works fine, however one can embed columns from only one report at a time unfortunately...

Not sure if it is possible to modify the plugin to be able to embed columns from different reports?

Great work.

Thanks

Karim

 

In reply to karim faid

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Thanks for the suggestion Karim, but it's something that I have to analyze previously to implement.

I will add this request in the project tracker

In reply to Juan Leyva

Re: New plugin: Custom reports

by Johnny Zephyr -

HI

Great plugin i must say!

ok, i need some more filters adding. Courses, start and end dates are good but i need some of my own. How do i go about adding my own filter?

So, i basically want to create custom filters - how do I go about doing so?

Thanks Alot.

In reply to Johnny Zephyr

Re: New plugin: Custom reports

by Dan Jeffries -

Hi!

I am looking for some way to generate a report about Submitted Assignments and whether they have been graded/commented on by the tutor.

We use a lot of courses and to get a site-wide report regarding submissions and feedback would be amazing.

I don't know if this plugin is capable of doing such a task, so if you can advise otherwise that would be great.

Thanks!

Dan

In reply to Dan Jeffries

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Dan,

I think the plugin is capable using a User report or a SQL Report

Using a user report:

Download the last version of the plugin
Create a user Report in a sample course
Add a mod activiy column for each assingment in the course

Regards

In reply to Juan Leyva

Custom Filter

by Johnny Zephyr -

Hi

Does the PHP  code need to be edited if i wanted to add custom filters or is their a workaround does any one know?

If a php code file needs to be edited, which one do we add the custom filter code to?

Much appreciated thanks.

In reply to Johnny Zephyr

Re: Custom Filter

by Johnny Zephyr -

Hi Guys

As far as i'm aware this report module was shipped with two filters only. 'Courses' and 'Start/End time'.

For people who are looking to add or need Custom Filters in their reports you will have to write PHP code and write your own filter. So there is no easy workaround.

I have managed to add a custom filter but had to edit a couple of files in order to get it working. My custom filter was a 'userid' filter as I needed user specific data.

Great Module I must say. Thanks Juan.

In reply to Juan Leyva

Re: New plugin: Custom reports

by Charles McCoy -

Juan

The first thing I would like to say is great job on this plugin.

I'm intrested in being able to create a configurable report. I have view the samples they have listed which were nice but I didn't understand how to add my users to the report by the personal settings that I have added on. So I have added fields to the USER PROFILE FIELDS. Can any one help direct me in the right direction. I have listed the fields below.

Thanks for you Help

Charles

 
 

User profile fields

Personal Info. Edit

Profile FieldEdit
Last Name Edit Delete Move down
First Name Edit Delete Move up Move down
Middle Initial Edit Delete Move up Move down
Ticket Number # Edit Delete Move up Move down
Case Number Edit Delete Move up Move down
Date Ticket Issued Edit Delete Move up Move down
County where ticket was received Edit Delete Move up Move down
Address Edit Delete Move up Move down
City/Town Edit Delete Move up Move down
State Edit Delete Move up Move down
Phone Number Edit Delete Move up Move down
Driver's License Number Edit Delete Move up Move down
Date of Birth Edit Delete Move up Move down
How You Received Our Information Edit Delete Move up Move down
Where did you attend court? Edit Delete Move up

 

In reply to Juan Leyva

Re: New type of report, Moodle 2.0 suggestions

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hello all,

I haved created a new type of report: Categories report

This type of report can embed Courses reports, so it is a good choice for displaying the courses grouped by categories or only display certain categories, etc...

There is also a new type of report "Timeline report", that was added in previous releases

You can download the plugin and overwrite all the files (it doesn't require upgrade the dabase 'cause there are no modifications)

By the way, I'm working in the Moodle 2.0 version of this plugin, suggestions are very welcome.

For Moodle 2.0 a Cohorts report will be available

Also new columns regarding course completion for the user report

Juan

In reply to Juan Leyva

Re: New type of report, Moodle 2.0 suggestions

by Muhammed Memon -

Juan,

Thank you very much, I just installed the module and created a custom report and it works like a charm.  Just a quick question, is there a way to share report with the user where they can only view the reports without being able to make changes?  As I am using custom SQL to write a report and do not want access to manipulate the data using SQL command.

Thanks,

Muhammed

In reply to Muhammed Memon

Re: New type of report, Moodle 2.0 suggestions

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hi Muhammed, in the permissions tab you can select several "only view permissions" criteria. A link to the report will be displayed in the block to the user if he has the permissions configured in the permissions tab. Regards
In reply to Juan Leyva

Re: New type of report, Moodle 2.0 suggestions

by Benjamin Young -

Hello Juan,

You mentioned in one of your previous posts that you will add the filtering feature of by cohorts. Has this feature been added and if so how do I access it?

Thanks!

In reply to Juan Leyva

Re: New plugin: Custom reports - posible bug

by Jesus Perez -

Hola Juan, he instalado Custom Reports y va de maravilla, pero encontré un problema en el enlace de descarga. Al ejecutar el informe la primera vez el enlace funciona bien, pero si se aplica algún filtro, la URL pierde el identificador del curso (pe.:  .../viewreport.php?id=2) y por tanto el enlace a la descarga tambien lo pierde y queda algo como: /viewreport.php&download=1&format=xls

Esto imposibilita descargar el fichero ¿hay alguna previsión de solucionar esto? descargué la última versión pero falla igualmente.

Gracias y buen trabajo.

In reply to Juan Leyva

Re: New plugin: Custom reports

by avanzza ideas -

Hola Juan.

Me he bajado e instalado Configurable Reports, una maravilla, felicidades. Pero tengo un problema en un informe que necesito. Necesito sacar en cada curso, los alumnos con sus correspondientes evaluaciones por cada módulo.

Algo así:

Alumno| .... | Test1Hecho | Nota Test1 | Fecha Test1 |....etc.

Respecto a las 3 columnas del medio, en la primera (Test1Hecho) no tengo problemas pero de la segunda, la Nota referente a un módulo y la tercera, fecha, no las consigo sacar. He probado la Nota en "User module outline stats" pero en el report dicha columna me aparece en blanco en la primera para todos los alumnos y no sé si es problema mío o que no sé puede hacer y la fecha no sé ni donde buscarla.

Tan solo quería saber si es posible sacar estos dos atributos de forma directa o me debería buscar la vida por otro lado.

Muchas gracias de antemano.

In reply to avanzza ideas

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hola, por favor, descarga de nuevo el bloque y remplaza los archivos existentes por los nuevos. Había un bug en el bloque que ya he solucionado. Ya deberías ver la nota y la fecha del Test en una misma columna. Saludos
In reply to Juan Leyva

Re: New plugin: Custom reports

by avanzza ideas -

Hola Juan.

Muchas gracias por la actualización me ha venido de lujo. Aún así me falta una columna para tener mi informe, el tiempo dedicado para realizar el test del que se extrae la nota.

Lo ideal supongo que sería hacerlo en una consulta SQL pero me estoy volviendo loco con las tablas de grade y no sé cómo sacar esto, ¿alguna idea?

Otra cosa, si un módulo tiene distintos tests ¿es posible sacar la información de cada uno?

 

In english.

Does anyone know how can I make a report in which one column is the time spent to make a test?

Any SQL query?

Concretly, the time spent in the test which has the highest qualification.

If a module has different tests included, is it possible to extract the information for each one?

Gracias / Thanks!

In reply to Juan Leyva

Re: New plugin: Configurable reports - Course dedication time

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hi, II have updated the block including a new column plugin for calculating the total course dedication time (or site time) for an user. This new plugin works with date/time filters also and with timeline reports, so you can create reports showing the course dedication time of a user every week along a month, year... Regards
In reply to Juan Leyva

Re: New plugin: Custom reports

by Sarfaraz Malik -

Hi,

I need to add custom filters to the Progress/Grades page (grade/report/grader/index.php). Currently, this page displays all students. I would like to add the following filters:

Date range
Church Code (custom field created for the user profile)
Course content (assignment, test, etc.) - multi-select field

In addition, I also need to add Date range and church Code to the Excel Export option for this page (grade/export/xls/index.php). The export should also include the column of "Church Code" (which is a custom field we created for the user profile).

Please help me out. Can I use this component to do the same?

regards,

Sarfaraz

In reply to Sarfaraz Malik

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hi Sarfaraz, using this plugin you can get a list of users which him Church code and the ouline report of each activity (grade and date of assignments, test, etc...) (the same for the export) But you can't add the date range as a column. Anyway, is something that can be done easily, I will add a new column called date range dates as soon as I can Regards
In reply to Juan Leyva

Re: New plugin: Custom reports

by Benjamin Wolf -

Hi,

first thank you Juan for this great plugin. I have been playing around a little with the block and have some problem with the line graph.

I don't get any lines in the graph. When i' am using the Detailed ACTIONs for each MODULE query out of the ad-hoc contributed reports for Example. I set the x-axis to the module, the line series to the actions and the count to the y-axis. I want to have a graph to show wich action is done how often in which module.

As result i get a blank graph, even the axis are only counting from 0-1(y axis) and 0-4(x axis). So it is not only he dosen't print the graph. It seems to me he don't calculate how much the scale has to be too. Does anyone have similar experience with the line graph?

By the way the pie chart works fine so it is not a Problem with printing at all. May be something in the calculation of the line chart itself?

As suggestion to enhance the plugin i would like to have more plots like a bar chart and so on and make them more customizalbe.

Regards

 

In reply to Benjamin Wolf

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hi,
the line graph was initially designed for the Time line report but It should work for others reports.
I will check the source code to find what is happening

Can you export your report and upload it in a new post?

Regards
In reply to Juan Leyva

Re: New plugin: Configurable reports - Moodle 2 version

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
A first Moodle 2.0 version of this plugin is available for download at: http://download.moodle.org/download.php/plugins/blocks/configurable_reports.zip After more testing of this first version I will update the Modules and Plugins entry adding this link (In a week I hope)
In reply to Juan Leyva

Re: New plugin: Configurable reports - Moodle 2 version

by Bernardo Ledo Bogdan -

Hi Juan,

First of all, let me thank you for this plugin, it's really usefull.

I'm running Moodle 2.0.1 Version (Build: 20101225) and I have just installed the 2007101509 version of your plugin.

When creating a new SQL report, I'm trying to create a Pie Plot, so when selecting this kind of plot in the combo box, I'm getting the following error: "rs_fetch_next_record() not available anymore".

Because I'm really new in the Moodle world, I have been trying to search in the internet how to solve this issue, but I haven't got any answer yet. Could you please help me with this issue?

Thanks and best regards!

Bernardo.

In reply to Bernardo Ledo Bogdan

Re: New plugin: Configurable reports - Moodle 2 version

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hi Bernardo,

the Moodle 2.0 plugin's version is still beta since is not well tested as the 19 ones.

What you have found is a bug that I will fix as soon as posible

Thanks, and please report all reports you find
In reply to Bernardo Ledo Bogdan

Re: New plugin: Configurable reports - Moodle 2 version

by Carl Hodkinson -

Hi,

First of al, let me say that I think this block is great - I just wish I knew how to use it and get the best out of it.

Like Bernardo, I am getting this error, plus I am also getting the following when I am trying to use this block;

  • sql_ilike() not available anymore
  • stripslashes_recursive() not available anymore

One place where the stripslashes  errorcomes up is when I am trying to show the individual students in courses so am starting with a course report and adding course fullname and number of users with a student role.

The "sql_ilike() not available anymore" error comes up when trying to use conditiions, e.g. in a course report, having a condition "ID<>1"

I get the error message when I view the reports.

I am using 2.0.2 with the latest code for the block.

Any help would be appreciated.

Carl

In reply to Carl Hodkinson

Re: New plugin: Configurable reports - Moodle 2 version

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Carl, there are a few bugs in the 2.0 version, I feel so sorry but I haven't fixed it yet

I will try to fix them this next weekend. It's not so much work

By the way, you can ask some programmer of howtomoodle to help you ;)

In reply to Juan Leyva

Re: New plugin: Configurable reports - Moodle 2 version

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I have fixed a lot of bugs in the 2.0 version. This Monday I will upload the changes because in my current computer I can't
In reply to Carl Hodkinson

Re: New plugin: Configurable reports - Moodle 2 version

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Carl and Bernardo,

I have fixed some bugs in the 2.0 plugin version

Wait 24 hour to let the server re-create the new zip or download the plugin from cvs (HEAD branch)

There are some bugs in the plot but is something I will fix in the next few days

The ilike, stripslashes_recursive and fethch records issues are solved

In reply to Juan Leyva

Re: New plugin: Configurable reports - Moodle 2 version

by Deepa Manickavasagam -

Hi Juan,

This is a great plugin! I did try using it and it works for the most part, but I cannot seem to get the LIMIT operand working:

SELECT a, b, cFROM `prefix_data_content` WHERE `a` = 'param1' OR `a` = 'param2' ORDER by `recordid` DESC LIMIT 2

Without the "LIMIT 2" the sql executes; with the "LIMIT 2", it fails. Any ideas? Thanks.

In reply to Juan Leyva

Re: New plugin: Custom reports

by John Fisher -

He intentado instalar este plugin en un Moodle 1.9.8+ pero me da un error al intentar añadir un informe. Ocurre después de rellenar el formulario de «Add report». Al darle al botón «Add» para que guarde el nuevo informe me devuelve una página con un error «badcomponent». Esto ocurre escogiendo cualquira de los tipos de informe.

Después de buscar por Google sin encontrar nada he echado una ojeada al código fuente y creo que he encontrado dónde me está dando el error: en el fichero «editcomp.php» en la línea 66. Lo que no sé es porqué.

Me puedes orientar un poco?

Saludos

In reply to John Fisher

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hola John, el error que comentas es extrano, por favor, activa la depuración desde Administración -> Servidor -> Depurando, Mostrar todos los errores y selecciona mostrarlos por pantalla y me dices que error te aparece.
Lo que parece a priori es que no has subido todos los ficheros del bloque
Saludos
In reply to Juan Leyva

Re: New plugin: Custom reports

by Joe Deegan -

Hello All,

I don't know anything about SQL but I am wondering if I can use this block to create a site wide grade report for all users.  I would like the report to show the final grade of each course the user is enrolled in for all users.  Is this possible using this plugin?  If so, can you provide an example of what settings to use?

I have been testing various types of reports and have not been able to create what I am looking for.  I am running into errors but I think they may be due to the settings I have selected.

Any help or suggestions for a site wide grade report is greatly appreciated.

In reply to Joe Deegan

Re: New plugin: Custom reports

by Joe Deegan -

Sorry, forgot to mention I am using Moodle 1.9.9.

In reply to Joe Deegan

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Joe,

is very easy:

- Create a "courses report" called "My courses final grades"

- Add two columns: Course name, final grade for current user

So at this point you have a report that shows for the current user the final grades.

Now we have to create a User report for displaying all the users in the platform and link this report to the previous ones.

- Create a user report called "All users final grades"

- Add a column for the username or several columns for firstname, lastname, etc..

- Add a "other report column" column, select the  "May courses final grades" report and the course name column, repeat the same for the final grade report

That's all, easy when you understand how it works smile but the point is that not easy undersantd it sad

In reply to Juan Leyva

Re: New plugin: Custom reports

by Joe Deegan -

Hi Juan,

Thanks for the instructions.  Creating the report went smooth but I am running into trouble viewing it.  When I try to view it I wait along time and finally get an internal server error.  Maybe too much data?  Any suggestions are highly appreciated.

In reply to Joe Deegan

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Yep, maybe too much data. Can you tell me the number of courses and users in your Moodle installation? You are displaying all the users in the same report? Regards
In reply to Juan Leyva

Re: New plugin: Custom reports

by Joe Deegan -

Thanks for responding Juan. Yes, for all users and all courses.  We have about 1000 users and 40 courses.  I suspect it may be too much.  Maybe I can try adding a condition or filter so it is less data?

In reply to Joe Deegan

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Yep, adding a condition (user profile or course) maybe is the solution.

 

Regards

In reply to Juan Leyva

Re: New plugin: Custom reports

by humberto moreno -

Hola juan hice al pie de la letra este reporte por que es mas o menos lo que necesito, que me muestre el userID, la calificacion y la institution entonces leyendo abajo veo q dices q seria bueno agregarle mas que un filtro una condicion debido a la cantidad de usuarios que manejo, como haces esto podrias ayudarme? lo que yo requiero es que te muestre una lista de cursos disponibles y de ahi te muestre ya las calificaciones ya que si lo dejo asi se queda en blanco debido a la cantidad de datos. entonces alguna idea de como puedo meter la condicion por institucion o por curso?

In reply to Juan Leyva

Re: New plugin: Custom reports

by Dave Dannenberg -

This block is really great. I've installed it in 1.9.8 and things seem to work except my charts. I tried creating a simple list of countries my students are in and the pie chart didn't turn out so well. Any ideas? Is it just becasue I have too many values

In reply to Dave Dannenberg

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Dave,

can you export the report you have created and attached here the xml file using the export feautes in the manage reports page?

Exporting a report doesn't means export private data. The information exported is only the settings of the report.

Regards

In reply to Juan Leyva

Re: New plugin: Custom reports

by Dave Dannenberg -

Thanks Juan.  I appreciate your help.

In reply to Dave Dannenberg

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Dave,

the file seems corrupted, can you upload it again please?

Best if you can zipped it

Regards

In reply to Juan Leyva

Re: New plugin: Custom reports

by Martin Perumala -

Hello Juan thx for the block. I have successfully installed it and its working. But I have a small problem I have a requirement of exporting the "configuration block report" into pdf format. I know that there is pdflib file and tcpdf directory. but dont know where to start working. Should I include a pdf folder in export directory ? Please help me!


In reply to Martin Perumala

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hi Martin,
for the PDF export you should add a pdf folder in the export directory, you can see how the export works in the others plugins, is easy to implement a new export plugin but I think you will have a hard work to make a good PDF export of the report.
Regards
In reply to Juan Leyva

Re: New plugin: Custom reports

by Martin Perumala -

Hello again. When I am choosing "Course reports" I can see "course field filter" and "start/end date" filters from the drop down menu. How can I add more filters here through coding. Could someone tell me which file to modify according to my requirement. Kindly help me!. thx in advance.

In reply to Martin Perumala

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hi Again Martin,
for adding filters you have to create a new folder in the components/filters directory. I suggest you to duplicate an existing filter you will see the minimun functions to reimplement and also the configuration values required.
No more is needed.
In reply to Juan Leyva

Re: New plugin: Custom reports

by Lavanya Manne -
Picture of Plugin developers

HI

Could anyone know to add extra filters (Category, Course, Department etc.,) in the type of report 'Users Report' as we have only

1.  Userfield Filter

2.  Start / End date filter

 

I need to add extra filters

 

EABYAS TEAM (INDIA)

In reply to Juan Leyva

Re: New plugin: Custom reports

by Martin Perumala -

Hello. Please can someone tell me what the two files plugin.class.php and editplugin .php useful for  in the configuration block source code. thx

In reply to Martin Perumala

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hi Martin,
I don't understand your question, can you clarify it?
In reply to Juan Leyva

Re: New plugin: Custom reports

by Martin Perumala -

sorry juan. actually I wanted to know the difference between plugin and a block. Is "editplugin" has same meaning as "editblock".

In reply to Juan Leyva

Re: New plugin: Custom reports

by Martin Perumala -

thx for the replies juan.     For the course report if I choose Category filter the drop down list of catergory filter contains catergory id's but not category names. Could you please tell me what appropiate file to change the code. I've went through the source code several times but to no avail. thx.

In reply to Juan Leyva

Re: New plugin: Custom reports

by Martin Perumala -

Hello. When I am creating custom SQL Report the default filters aswell as my custom filters are not working .But if I am creating other reports ( not SQL report) then filters are working . Please can someone help me ! .. thx

In reply to Martin Perumala

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Martin,

please, take a look to the documentation for seeing how the filters in the SQL report works:

http://docs.moodle.org/en/blocks/configurable_reports

Filters require a different implementation for SQL Reports than for the other type of reports.

You can take a look to the components/filters/course directory to see that they work different for SQL Reports:

http://cvs.moodle.org/contrib/plugins/blocks/configurable_reports/components/filters/courses/plugin.class.php?revision=1.1.2.3&view=markup&pathrev=MOODLE_19_STABLE

In reply to Juan Leyva

Re: New plugin: Custom reports

by Martin Perumala -

Hi Juan.. thx a lot for your help . I understood that I should add tokens to filters in the SQL queiry. I understood the syntax. But what exactly is token ? Is there any link online..

In reply to Juan Leyva

Re: New plugin: Custom reports

by Martin Perumala -

Hello Juan

subject : Problem with tokens.

I am just displaying courses from the mdl_course table and providing course filter using SQL report. But everytime I am selecting a course from the course filter drop down menu , I am always seeing "No Records" message even though I know that it should display the course I selected. Below is the SQL queiry I have written. kindly take a look(Note:I havent added any permissions or ordering)

SELECT c.id AS "Course id"

c.fullname AS "Course Name"

FROM prefix_course c

%%FILTER_COURSES:l.course%%

In reply to Martin Perumala

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Martin,

the filter token is not well constructed it should be:

%%FILTER_COURSES:c.id%%

Where:

c Is the alias for the course table you are using

id Is the col name for the course id

 

Regards

In reply to Juan Leyva

Re: New plugin: Custom reports

by Martin Perumala -

Hi Juan. I tried to modify the SQL queiry report as you suggested but unfortunately not working for me. I am sending you the SQL queiry that I have written along with the two screenshots( database mdl_course table and view report ) so that you may know what I am trying to do. Kindly take a look.

SQL Queiry:

SELECT c.id as "Course Id",

c.fullname as "Course Name"

FROM prefix_cource c

%%FILTER_COURSES:c.id%%

In the database mdl_course table the first colomn is the course id and the fifth column is the course fullname I am using.

database table screenshot image1

view report screenshot image2

 

My requirement : If I select one course name from the course filter drop down menu it should display only one course but its displaying all the courses.

Kindly help me ..thx

In reply to Martin Perumala

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hi Martin,
try:
SELECT c.id as "Course Id", c.fullname as "Course Name" FROM prefix_cource c WHERE 1 %%FILTER_COURSES:c.id%%
This also should work
SELECT c.id as "Course Id", c.fullname as "Course Name" FROM prefix_cource c WHERE 1=1 %%FILTER_COURSES:c.id%%
Anyway, I suggest you to turn on Debugger mode in Moodle and display erros in the browser, so if the SQL query is not correct a message error will be displayed Regards
In reply to Juan Leyva

Re: New plugin: Custom reports

by Kevin Hunt -

Hi all. I've installed this on 1.9 but not really had a chance to try it (until now) but my sql knowledge is from 20+ years ago and isn't up to much so need some help.

We have roughly 50 students enrolled across 6 courses. I have been asked to produce (by Monday !) a report on each student showing what resources they have looked at (number of times and dates) for each course.

Each student is enrolled on 3 courses.

The standard Moodle activity report for a course is not bad but the only way I seem to be able to use this is to grab a screenshot and then convert it to a pdf. When doing so the results are very small and hard to read.

The other issue is that for each of their assignments (we don't use gradebook as our criteria are HND pass/merit/distinction) I set up a forum with posts of useful info for them to read. The Moodle activity report just says they haven't made any posts (and I'm not expecting them to) but doesn't say which posts they have looked at.

My question is, will this plug-in allow me to create the required report and show all the relevant info .... and if so, how ? (help !)

Many thanks

 

Kevin

In reply to Juan Leyva

Re: New plugin: Custom reports

by Lavanya Manne -
Picture of Plugin developers

Hi Juan Leyva,

Components/filters/startendfilter

I need to add an  extra operator (equal to) in an array i.e., my start and end dates should work with 'equal to' operator like

%%FILTER_STARTTIME:r.enrolldate:=%%
%%FILTER_ENDTIME:r.enrolldate:=%%

But this isn't working in the plugin, the operator (equal to) isn't taking and it shows No records.

With Regards,

Lavanya

In reply to Juan Leyva

Re: New plugin: Custom reports

by Lavanya Manne -
Picture of Plugin developers

Hi Juan Leyva,

I need to add a new filter 'Department' and here is the code i worked on.

//$departmentlist = array_keys(get_records('user_info_data'));
$departmentlist = get_records_sql('SELECT data FROM mdl_user_info_data WHERE fieldid=6');
}
$departmentoptions = array();
$departmentoptions[0] = get_string('choose');
if(!empty($departmentlist))
{
$departments = get_records_select('user_info_data','id in ('.(implode(',',$departmentlist)).')');
foreach($departmentlist as $d)
{
$departmentoptions[$d->id] = format_string($d->data);
}
}
$mform->addElement('select', 'filter_departments', get_string('departments'), $departmentoptions);
$mform->setType('filter_departments', PARAM_INT);        
}
}

I am was able to display the filter dropdown succesfully, but need help in adding  my sql query like %%FILTER_DEPARTMENTS:----%%

 

WIth Regards,

Lavanya

In reply to Lavanya Manne

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
You have to implement a function called executed in your filters/departments/plugin.class.php
You can use the code of this filter as template:
http://cvs.moodle.org/contrib/plugins/blocks/configurable_reports/components/filters/courses/plugin.class.php?revision=1.2&view= I think it should look like: function execute($finalelements, $data){ $filter_departments = optional_param('filter_departments',0,PARAM_INT); if($this->report->type == 'sql'){ if(preg_match("/%%FILTER_DEPARTMENTSsad[^%]+)%%/i",$finalelements, $output)){ $replace = ' AND '.$output[1].' = '.$filter_departments; return str_replace('%%FILTER_DEPARTMENTS:'.$output[1].'%%',$replace,$finalelements); } } return $finalelements; }
In reply to Lavanya Manne

Re: New plugin: Custom reports

by Jesús Deloya -

Hello, i need to make a report with the next fields, Name, Campus or City and Calification, can this plugin hel me?

In reply to Jesús Deloya

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Yes, here you have the documentation:

http://docs.moodle.org/22/en/Configurable_reports

In reply to Juan Leyva

Re: New plugin: Custom reports

by Fouzi Sukhilala -

Hi Juan,

I just wanted to test the module by executing the SQL Report within the documentation.

when I add the calculation of Hits I got this error when trying to view the report:

Erreur de programmation détectée. Ceci doit être corrigé par un programmeur : PHP catchable fatal error.

In reply to Juan Leyva

Re: New plugin: Custom reports

by JC Dodo -

Hi Juan,

I have Moodle 1.9 and was migrated from windows platform & mssql db to linux & mysql. Now, when I click save changes the SQL query statement from Custom SQL, it gives me "Query failed". 

I would appreciate your help to advise how to fix the below sql statement which I got from http://docs.moodle.org/22/en/ad-hoc_contributed_reports#All_Ungraded_Assignments_w.2F_Link

 

SELECT 
u.firstname AS "First",
u.lastname AS "Last",
c.fullname AS "Course",
a.name AS "Assignment",

'<a href="http://moodle.domain.com/mod/assignment/submissions.php' + char(63) +
+ 'id=' + cast(cm.id AS varchar) + '&userid=' + cast(u.id AS varchar) +
+ '&mode=single&filter=0&offset=2">' + a.name + '</a>'
AS "Assignmentlink"


FROM prefix_assignment_submissions AS asb
JOIN prefix_assignment AS a ON a.id = asb.assignment
JOIN prefix_user AS u ON u.id = asb.userid
JOIN prefix_course AS c ON c.id = a.course
JOIN prefix_course_modules AS cm ON c.id = cm.course

WHERE asb.grade < 0 AND cm.instance = a.id AND cm.module = 1

ORDER BY c.fullname, a.name, u.lastname

 

Looking forward to hearing from you.

Thanks.

James

In reply to Juan Leyva

Re: New plugin: Custom reports

by Lavanya Manne -
Picture of Plugin developers

Hi Juan,

How could we give conditions in an SQL report from database

ex : %%FILTER_STATUS:c.id LIKE P %%

I want all the rows starting with alphabet 'P' from database.

 

In reply to Lavanya Manne

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi

,

I don't understand very well your question. You are asking how to add conditions in a SQL report but you are pasting a piece of code that users a FILTER

The SQL code for get all the rows starting with alphabet P is: columnName LIKE 'P%'

An example:
SELECT * from sometable WHERE somecolumn LIKE 'P%' Regards
In reply to Juan Leyva

Re: New plugin: Custom reports

by Lavanya Manne -
Picture of Plugin developers

First Let me

Thank you for your kind reply ,

My exact requirement was I have three Filter options (P Alpahabet, T Alpahabet, E Alpahabet, C Alpahabet in my select dropdown). When i select P Alphabet filter all courses with alpahabet P should display, like wise with T,E & C and my table is course with column name shortname and my query looks  like

"SELECT shortname FROM mdl_course WHERE shortname LIKE '%P%'". But as of now I am able to get only one record and all other were missing.

How could we do this in SQL Report.

Attachment Test.JPG
In reply to Juan Leyva

Re: New plugin: Custom reports

by Sowi So -

Very useful!

In moodle 2.0.2. , selections often do not work in FF.
fir instance in Time report the Timeline settings do not save and in a user report the Calculations do not work.

Google Chrome posts a 500 error. Does this have to do with my installation?

Attachment user_report.jpg
In reply to Sowi So

Re: New plugin: Custom reports

by Daniel Wright -

I have the same problem with a 2.0.2 installation.  I get quite a few 500 errors when adding columns, conditions, filters, etc.  I wonder if some of these things have simply been moved in 2.x and the Configurable Reports code just needs to be updated to look in the correct place?

Overall this is a very helpful block.  At least it makes for an easy place to add custom SQL reports and make them available to the administrative users who ask for them. 

In reply to Daniel Wright

Re: New plugin: Custom reports

by Mark Scacco -

I am experiencing the same problem. I have tested in Chrome, FF6 and IE9. When I try to apply a filter to a report, I get a 500 error or the page doesn't load at all (blank page in FF6):

"HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request."

Has anyone found a fix for this?

Thanks,

Mark

In reply to Juan Leyva

Re: New plugin: Custom reports

by Esteban Sánchez -
Gran Trabajo! Nice worj, work. A very escalable & modularized contrib. I like to do only ONE thingmore: A Filter by Group. ¿How could I do that? A personalized SQL queri? I dont have that knowledge... Thank you a lot! Muchas Gracias, Juan
In reply to Juan Leyva

Re: New plugin: Custom reports

by Sandeep Gill -
Picture of Plugin developers

Hi Juan,

That's an awesome plugin!

I've just started working on moodle. Came across your plugin, found it amazing and installed it. Was just wondering, if I could create custom filters or add additional filters in the SQL report.

 

Thanks

Sandeep

In reply to Sandeep Gill

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Yes, you can create fileters for SQL reports. Please review previous messages in thies forum post for brief instructions.
The best you can do is review the code of how are implemented the course filter (components/filters/course)
In reply to Juan Leyva

Re: New plugin: Custom reports

by Marcelita Bruckmann -

Hola, ante todomuchas gracias por el gran esfuerzo que comparte con nosotros, por mi parte pienso que deberia haber alguna forma de retribuite el esfuerzo.

Te cuento que copie la carpeta a mi carpeta blocks y luego fui notificaciones y hasta ahi todo bien

Luego en la portada habilite el modo edicion y elegi en el desplegable la opcion de repportes personalizados, hasta ahi todo bien.

Luegome di cuenta que no cambio nada, pero por el contrario ya no tengo el desplgable para agregarnuevos modulos o bloques en la portada, para descartar el error me fui a un curso e hice lo mismo y elmismo problema, no carga el bloque y se me desaparece el desplgable.

Que podria estar pasando. Gracias

In reply to Marcelita Bruckmann

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hola Marcelita,
¿qué versión de Moodle estás usando? Lo que puedes hacer para arreglar temporalmente el problema es desinstalar elbloque desde administración - Módulos y extensiones y posteriormente borrar la carpeta de blocks.
Saludos
In reply to Juan Leyva

Re: New plugin: Custom reports

by Mark Scacco -

Does this work in 2.0+ ?

In reply to Mark Scacco

Re: New plugin: Custom reports

by David Hagen -

When I did the download of the block there were two links...one for 1.9 and one for 2.   I used the one for 2 as that is the Moodle version I started with as a new user. I currently have version 2.0.2. So, my problem is with that version.

In reply to Juan Leyva

Re: New plugin: Custom reports

by Lavanya Manne -
Picture of Plugin developers

Hi Juan Levya,

I created SQL Report and now i want to give access to the selected users (that I choose) to view the report. How this can be done?

In reply to Lavanya Manne

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi, the best way is to create a custom user profile field and fill it with a custom string for your selected users.

In the report, in the permissions tab, add a "User field value" permission and select the profile field and type the required value.

regards

In reply to Juan Leyva

Re: New plugin: Custom reports

by Carlos Rodriguez -

Is there a way to add my own filters when using SQL reports???

I mean, with a SQL Report I only can filter by course or the course where the block is located and so on. But I'd like to add custom filters of the colums I'm showing on the report.

Also, if possible, not to show a dropdown on the filter but a textbox instead.

I'm asking you this because I need to place the block on the front page and make full site reports.

Using the premade user reports don't work for me because it takes more time to load and it doens't show the info I need.

For example, I need an Academic Performance report where you can search for a particular student by his/her ID number or, by his/her institution, course, etc; and by merging two reports I take about a minute to load that report and still don't have all the filters I need to set. That's why I need to set my own filters.

Greetings from Venezuela!

In reply to Juan Leyva

Help with sorting Certificate/Course users by Completion Dates?

by Corey Dodge -

Hey,

Just a quick question as to how I would go about creating a report that sorts users by completion dates of either receiving a "certificate" or a quiz completion from the most recent date to latest? Any help would be much appreciated thanks!!

In reply to Juan Leyva

Re: New plugin: Custom reports

by Marcus Beckenkamp -

I was trying to use a custom template in SQL Report, but the "##pagination##" variable was not working. To fix it I've added a line in the "print_template" function on "report.class.php" file.

$this->totalrecords = count($this->finalreport->table->data);

I wrote it on the 549 line in my report class sourcecode.

I am a beginner in Moodle development, so I don't really know this was a good idea... lol

In reply to Juan Leyva

Re: New plugin: Custom reports

by Glen Keune -

Hi, are any of you available for custom report development? (paid, of course) If so, please message me directly.

Thanks!

Glen

In reply to Juan Leyva

Scheduled reports

by Don Schwartz -

Juan,  

 

Is there any way to have automatically generated/emailed reports?  I don't think I can do that with a cron but perhaps there is a method.

I know the orginal custom SQL queries allowed scheduling and I have manager types who would dearly love a spreadsheet in their inbox each month.

In reply to Don Schwartz

Re: Scheduled reports

by Rahmat Costas -

 Hi all,

I downloaded this custom report block and installed into my local windows Moodle Testing environment for Moodle 1.9 I have been playing around with it and I can see very beneficial to us. Great work on this!

I just have a few questions before I decide to put this on our production environment:

  1. Date Filter (Filter Tap) does not look like it works when trying to set this up within the User Reports (It works when using it within the SQL Reports)
  2. The same with calculation tab. It does not seem to work(it returns a "0" when trying to calculate a column.
  3. When setting up SQL reports, most of the add-hoc SQL code provided does not work ( "Query Fails" when trying to save). Is there something I need to change in general for them to work? I was very interested to get the grade related reports working.
  4. We are using Moodle (currently 1.9.12) to anable an entire corporation to take eLearning. Has anyone been able to setup permission for these reports in such a way that managers can see their own progress as well of their employees under them? We are using a manager custom user profile field.

Thanks,

Rahmat.

In reply to Rahmat Costas

New question

by Fouzi Sukhilala -

Hi,

I have two questions about the plugins:

1- Are the historgram graphs supported?

2- Is there a kind of Site level reports (is shared between all courses)

Thanks

In reply to Don Schwartz

Re: Scheduled reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Don,

this is planned to be a new feature, see:

http://tracker.moodle.org/browse/CONTRIB-2435

But, nowadays I haven't time enought to add new features.

The only way to add new features is via funding (I work for a Moodle partner) or community contributions.

Regards

In reply to Juan Leyva

Re: Scheduled reports

by Martin Contreras -

Hi Juan,

I´m moodle developer I can help you with this feature because I did some alerts for course access reminder for my moodle. This is my email: carlosmartin_mdc@yahoo.com.

 

Also, I plan to make other kind of reports such a participation of the teacher versus paticipation of students in any activity.

Something like this:

and the report is something like this:

In reply to Juan Leyva

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi all,

last night I fixed all the bugs mentioned above.

Please, wait 24 hours to download the plugin again, you can overwrite the old php files with the new ones.

Thanks all for your help (and also for the fix of some bugs)

Regards

In reply to Juan Leyva

Re: New plugin: Custom reports

by Mark Scacco -

Hi Juan,

Thanks for the update. Has the new build been posted? Does it contain fixes for the 500 errors that appear when one tries to apply a filter?

Thanks a lot for creating this plugin. It's great!

Mark

In reply to Mark Scacco

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Mark,

this is one of the erros I can't fix because I can´t reproduce it

Please can you follow this steps to try to get more information:

Go to Admin - > Server - Debugging

Select show all errors

Check display errors

Try to use a filter, If you get some output in your browser please, add a new reply to this post

 

Regards

In reply to Juan Leyva

Re: New plugin: Custom reports

by Mark Scacco -

Hi Juan,

Here is the output. There's not much here:

A required parameter (id) was missing

More information about this error

Stack trace:
  • line 429 of /lib/setuplib.php: moodle_exception thrown
  • line 468 of /lib/moodlelib.php: call to print_error()
  • line 28 of /blocks/configurable_reports/viewreport.php: call to required_param()
In reply to Juan Leyva

Re: New plugin: Custom reports

by Luis Bou -

Hello/Hola Juan

Spanish, then English translation below

 

Estoy probando Configurable Reports y me parece justo lo que estaba buscando. Me encuentro un problema: Al hacer el tutorial llego a un punto en que me da este error:

 

<code>

Fatal error: Allowed memory size of 100663296 bytes exhausted (tried to allocate 82 bytes) in /usr/local/moodle/moodle_test/lib/dmllib.php on line 728

Fatal error: Class 'ADODB_Session' not found in Unknown on line 0

</code>

 

Si simplifico los detalles del informe consigue generarlo. Estoy haciendo pruebas sobre un curso real, de 20 alumnos y 4 meses de duración. Me extraña que pidiendo "aparentemente" tan poca memoria de fallo. ¿Te suena a conocido?

Muchas gracias

Luis Bou

-----------

Estoy probando Configurable Reports y me parece justo lo que estaba buscando. Me encuentro un problema: Al hacer el tutorial llego a un punto en que me da este error:

 I'm testing Configurable Reports and seems just what I've been looking for, but I'm having an issue doing the tutorial. I get this error

<code>

Fatal error: Allowed memory size of 100663296 bytes exhausted (tried to allocate 82 bytes) in /usr/local/moodle/moodle_test/lib/dmllib.php on line 728

Fatal error: Class 'ADODB_Session' not found in Unknown on line 0

</code>

 If I simplify the demands for the report, it gets done. I'm testing this module on a real course, 20 students, 4 months long. It seems strange that requesting "apparently" so little memory I get this error. Does it ring a bell?

Thanks a lot

Luis Bou

In reply to Luis Bou

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hola Luís,

por favor, exporta el informe desde la página principal de gestión de informes.

Te generará un archivo XML, cuélgalo en e lforo para que lo pueda descargar y probar el informe.

El informe no contiene datos privados (sólo de configuración) así que es seguro que lo cuelgues aquí.

Saludos

In reply to Juan Leyva

Re: New plugin: Custom reports

by Martin Contreras -

Hi Juan,

First, thank you for your plugin. It´s very important for moodle.

I have a couple of questions. I´m working work with this version of moodle 2011070100.00 Release 2.1 and with this version of the module: 2007101509.

This is the scenario in my moodle. I have categories, subcategories and courses. I found an external application of statistcs only in forum in moodle by time.

1. I´m testing Creating a SQL Report I´m using the query of Courses activity with filters everything is ok but in the parts of calculations and graphics, it doens´t appear the column´s names

2. Is it posible to filter first by category and then by courses. Disabling first the field of courses

 

 this is an external app

Thank you

I can help you with the part of emails

this is my skype carlosmatin.contreras  .

Now, I´m full time moodle developer

 

Gracias por todo !

In reply to Martin Contreras

Re: New plugin: Custom reports

by Martin Contreras -

No se si es la versión de Moodle pero creo que en los reportes sql hay un bug que no salen los campos para hacer gráficas. He arreglado ese bug y además he creado el tipo de gráfica de bar y ahora voy a hacer esta:

http://pchart.sourceforge.net/documentation.php?topic=advexemple26

Voy a comparar la participación de los profesores versus los alumnos para un actividad en principio lo pienso hacer para los foros.

 

Saludos,

In reply to Juan Leyva

Re: New plugin: Custom reports

by Martin Contreras -

Hola a Todos,

Quiero ejecutar este query en informeSQL y me sale error en base de datos. Les dejo el query para que lo prueben y me avisen si el módulo no soporta este query:

SELECT DATE_FORMAT( FROM_UNIXTIME( fp.modified ) , '%Y/%m/%d' ) AS date, 
(SELECT
count(fp.userid)
FROM prefix_forum_posts fp,
prefix_role_assignments AS ra,
prefix_context AS ctx,
prefix_course c,
prefix_forum_discussions AS fd
WHERE
ra.contextid = ctx.id AND
ra.roleid = 5 AND
c.id = 199 AND
ctx.instanceid = c.id AND
fd.course = c.id AND
fp.userid=ra.userid and
fd.course = ctx.instanceid and
fd.id = fp.discussion and
DATE_FORMAT( FROM_UNIXTIME( fp.modified ) , '%Y/%m/%d' ) = date) as studentParticipation,
(SELECT
count(fp.userid)
FROM prefix_forum_posts fp,
prefix_role_assignments AS ra,
prefix_context AS ctx,
prefix_course c,
prefix_forum_discussions AS fd
WHERE
ra.contextid = ctx.id AND
ra.roleid in (3,4) AND
c.id = 199 AND
ctx.instanceid = c.id AND
fd.course = c.id AND
fp.userid=ra.userid and
fd.course = ctx.instanceid and
fd.id = fp.discussion and
DATE_FORMAT( FROM_UNIXTIME( fp.modified ) , '%Y/%m/%d' ) = date) as teacherParticipation
FROM prefix_forum_posts fp,
WHERE fp.discussion in
(select fd.id
from prefix_forum_discussions fd
where fd.course = 199)
group by date

 Es sobre participación de alumnos y profesores en los foros. Además, he agregado un nuevo tipo de gráfico. Va a salir tal como este: 

http://pchart.sourceforge.net/documentation.php?topic=advexemple26

De antemano muchas gracias, mientras yo sigo invetigando y cambiando, si es que puedo, código.

Que buen módulo me ha ahorrado mucho trabajo

Saludos,

In reply to Martin Contreras

Re: New plugin: Custom reports

by Martin Contreras -

Ya lo resolví, habia dejado una coma en el último where 

FROM prefix_forum_posts fp,

Así quedaría el query
SELECT DATE_FORMAT( FROM_UNIXTIME( fp.modified ) , '%Y/%m/%d' ) AS date, 
(SELECT
count(fp.userid)
FROM prefix_forum_posts fp,
prefix_role_assignments AS ra,
prefix_context AS ctx,
prefix_course c,
prefix_forum_discussions AS fd
WHERE
ra.contextid = ctx.id AND
ra.roleid = 5 AND
c.id = 199 AND
ctx.instanceid = c.id AND
fd.course = c.id AND
fp.userid=ra.userid and
fd.course = ctx.instanceid and
fd.id = fp.discussion and
DATE_FORMAT( FROM_UNIXTIME( fp.modified ) , '%Y/%m/%d' ) = date) as studentParticipation,
(SELECT
count(fp.userid)
FROM prefix_forum_posts fp,
prefix_role_assignments AS ra,
prefix_context AS ctx,
prefix_course c,
prefix_forum_discussions AS fd
WHERE
ra.contextid = ctx.id AND
ra.roleid in (3,4) AND
c.id = 199 AND
ctx.instanceid = c.id AND
fd.course = c.id AND
fp.userid=ra.userid and
fd.course = ctx.instanceid and
fd.id = fp.discussion and
DATE_FORMAT( FROM_UNIXTIME( fp.modified ) , '%Y/%m/%d' ) = date) as teacherParticipation
FROM prefix_forum_posts fp
WHERE fp.discussion in
(select fd.id
from prefix_forum_discussions fd
where fd.course = 199)
%%FILTER_STARTTIME:fp.modified:>%% %%FILTER_ENDTIME:fp.modified:<%%
group by date

In reply to Juan Leyva

Re: New plugin: Custom reports New type of report

by Martin Contreras -

Hi Juan,

I made a report of participation of students and teacher in forums. But now, the user wants a report by activity and item in this activity. I plan to make a new report, maybe is a hybrid between sql report and the other one something like course report. This report should have 3 filters one by activitity , items of the activity and the last one by dates. Something like this

 

I plan to make a hardcode report only with two tabs Report and ViewReport, settings the above filters or maybe (I guess I have to spend more time) one report for the community. What is you suggest ? 

Thank you and I hope you can answer me asap 

Regards,

 

Martin

In reply to Juan Leyva

Re: New plugin: Custom reports

by Gautam Bishwas -

Your block is great thnks juan and tim

Today I have installed this block into Moodle 2.1 and getting some error (1)array_shift require first parametre is array you are given object

(2)print_table is deprecated use html::writer

my question is .Is this block is compatible to Moodle 2.1?

Regards

Gautam

In reply to Gautam Bishwas

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Gautam,

but the plugin doesn't work at all?. I mean, you get this error in every page?

Can you go to admin -> server -> debugging choose display errors and show all errors

I need the full error to see what is happening

In reply to Juan Leyva

Re: New plugin: Custom reports

by Jennifer Miles -

I have this installed (version 2010060101) in a 1.9.10 Moodle install.  It works great except for two issues I'm now facing.

One - When a User report is exported then reimported to a new course, the Course Name does not change.  (The report runs with the new course data though)

Two - Once the block is placed in a course, it can not be removed.  The edit buttons do not display.  They do show up on the home page instance of the block though.  I am trying to remove it from a course, but can't.

Any help would be appreciated. The server is not mine so can't do too much  "playing".  I was just contacted to write a SQL report but have seen these two issues and have been asked if I can fix them.

In reply to Jennifer Miles

Re: New plugin: Custom reports

by Jennifer Miles -

I have another possible issue.  When exporting a SQL report to XLS, it works fine as long as no filters are selected.  If a filter has been selected, the XLS export throws an error: The requested URL /blocks/configurable_reports/viewreport.php&download=1&format=xls was not found on this server."  It looks like it's missing the id info.

In reply to Juan Leyva

Re: New plugin: Custom reports

by Hugo Prat Torres -

Hi Juan,

first congratulations for a great module.

My problem is that I'm trying to make a custom report showing all grades for students in a specific course. I found and ad-hoc contributed report that does almos that "Site-Wide_Grade_Report_with_All_Items" but I need a specific course instead for all courses. I tried to filter by course in the filters tab of the custom report but it didn't work so I think I should modify the sql statement.

Can you please help me a bit? Thanks in advance,

hugo.

SELECT u.firstname AS 'First' , u.lastname AS 'Last', u.firstname + ' ' + u.lastname AS 'Display Name', 
c.fullname AS 'Course',
cc.name AS 'Category',
 
CASE
WHEN gi.itemtype = 'course'
THEN c.fullname + ' Course Total'
ELSE gi.itemname
END AS 'Item Name',
 
ROUND(gg.finalgrade,2) AS Grade,
DATE_ADD('1970-01-01', INTERVAL gi.timemodified SECONDS) AS Time

 
FROM prefix_course AS c
JOIN prefix_context AS ctx ON c.id = ctx.instanceid
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id
JOIN prefix_user AS u ON u.id = ra.userid
JOIN prefix_grade_grades AS gg ON gg.userid = u.id
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid
JOIN prefix_course_categories AS cc ON cc.id = c.category
 
WHERE gi.courseid = c.id
ORDER BY lastname
In reply to Juan Leyva

Re: New plugin: Custom reports

by Randah Mouallem -

Hi Juan,

I was wondering if this plugin could be used to generate a customizable user report (grades). We were hoping to put the college logo on the page as well as the course name, student name, instructor name, etc all on one easy to print page.

Can we do this with your plugin?

Thanks,
Randah

In reply to Randah Mouallem

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Yes, you can smile

Remember to use the option "Template" where you define the way in which the report is displayed

Regards

In reply to Juan Leyva

Re: New plugin: Custom reports

by Glen Keune -
Juan (et. al.), I'm running into the 5000 record limit, and am wondering what are the ramifications of raising that limit or removing it altogether. The limit in question is on line 25 of report.class.php. Thanks, Glen
In reply to Glen Keune

Re: New plugin: Custom reports

by John Samuel -

Hope someone Can help us here please.

When we filter using this block we see some users that don't even exist in the system anymore! email address followed by bunch of numbers. any idea how to get rid of this please?

Thank you in advance!

John Sam

In reply to John Samuel

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi John,

add a condition to your report.  User field  condition, and choose delete = 0

Regards

In reply to Glen Keune

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Glen,

about this limit, I just copied it from the Tim Hut Custom SQL reports plugin.

I think that is a limit for avoid users to collapse your server if they create reports

If you are the site admin, I think it's fine to raise it if needed

Regards

In reply to Juan Leyva

Re: New plugin: Custom reports

by John Samuel -

Alert !

When i use a course report and pick : currentuserfinalgrade the grades are showing with 4 decimals after the ',' like 85.1252 how can i get the grade to show only 85.12

In reply to Juan Leyva

Re: New plugin: Custom reports BUG

by John Samuel -

Hi,

Course Report doesn't accept more than one Condition = courses in category

when i pick two conditions of 'course in category' it deletes everything.

i am using moodle 1.9.11

Thank you,

In reply to John Samuel

Re: New plugin: Custom reports BUG

by John Samuel -

i type as condition (c1 or C2)   once i click update everything resets and i have to start from the begning again. anyone can help here please?

Thanks

 

 

In reply to Juan Leyva

Re: New plugin: Custom reports

by Ivn Vai -

@Juan Leyva

Great work!! Very useful module. I was looking forward to build something along these lines.

I wanted to create a reporting feature which lets different users at different levels to view advanced reports (high level, overview level, individual)down their hierarchy.

The report data would be based on organization hierarchy i.e. say a manager can view a department report, within a dept he can select any of the sections, within a section, he can select any area and eventually any individual within that area.

Do you think your module is editable/modifiable to achieve this or does this require building a whole new module from scratch.

Awaiting your reply as after a lot of search I came across something which was relevant to my needs.

Thanks. N Keep up d good work !!

In reply to Ivn Vai

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Ivn,

this plugin is modifiable to achieve your requirements but it will take you a lot of time

I think the best way to achieve this is creating something from scratch but reusing all the plugin code you can

Regards

In reply to Juan Leyva

Re: New plugin: Custom reports

by Ivn Vai -

@Juan Leyva,

Thanks so much for your reply. I am planning to start the module from scratch but I am still not sure as to what tables I'll need, where I would display this plug-in and how to sort out the hierarchy issue? Is it something thats already there in moodle to deal with hierarchy issue (Dept/section/Area/Individual).

If its possible, could you maybe just try n outline the important steps that should be kept in mind in order to build this plugin? (Maybe you can email me a rough outline on ivnvai@yahoo.co.uk pls.) And do you know how much time it can aproximately take to build this module?

I know this is probably a lot to ask but I need some one's help as I am totally new to Moodle n especially module development. Input from you would be really valuable n helpful to me at this stage.

In reply to Juan Leyva

Re: New plugin: Custom reports

by Paolo Sabatinelli -

Hi Juan,

I'm trying to configure the report, but when I've to insert a column (i.e. course stats) I can't see any update (file custom.jpg)

and when i try to upload i receive this error:

"Fatal error: Call to a member function update_record() on a non-object in C:\......\Moodle\2.1.2\server\moodle\blocks\configurable_reports\components\columns\component.class.php on line 79 "

could you please help me?

 

thanks

Attachment custom.jpg
In reply to Juan Leyva

回應: New plugin: Custom reports

by Bear Hung -

Hi,Mr.Leyva, your configurable report block is very useful,but I need some other filter like "all Participant","all course activity","all action","download in EXCEL or show in the website" which in the original course report.How can I get these filter? Thank you

In reply to Juan Leyva

Re: New plugin: Custom reports

by Jonathan Herrera -

Hi to everyone

I nedd a quick way to generated automated email notifications on Report -> Statistics? I need to know every friday the statistics for a particular class, Is this something that is easy to implement?

best regards


In reply to Jonathan Herrera

Re: New plugin: Custom reports

by sumit negi -

Hi All,

I want to create a report about teacher contribution in course I want to count posts that are made by each teacher in a course.

Can anyone suggest me.

In reply to sumit negi

Re: New plugin: Custom reports

by roc mehra -

Hi All,

 

I wnat to pull report total hits course wise monthly.Please help me out

In reply to Juan Leyva

Re: New plugin: Custom reports

by roc mehra -

Hi Juan,


I have used your plugin. I have need to do i have to pull reports of total hits per course for a particular period. i.e start date to end date. How can i do that.

In reply to Juan Leyva

Re: New plugin: Custom reports

by Lavanya Manne -
Picture of Plugin developers

Hi Juan,

I have an error while adding COUNT in my sql query

SELECT

COUNT(DISTINCT u.firstname),

COUNT(DISTINCT u.lastname),
u.firstname AS "First Name",
u.lastname AS "Last Name",
u.email AS "Email",
u.city AS "City",
u.country AS "Country",
u.sex AS "Gender",
org.fullname AS "Program"

FROM
prefix_user u,
prefix_org org

WHERE
u.programid = org.id AND

1%%FILTER_EMAIL:u.email%%
%%FILTER_FIRSTNAME:u.firstname%%
%%FILTER_LASTNAME:u.lastname%%
%%FILTER_PROGRAMS:org.id%%
GROUP BY u.firstname

And when I choose SUM from calculations tab for firstname and lastname. Now COUNT is showing at the top display report as well as at the bottom calculations display report. I want only the COUNT to be displayed at the bottom calcualtions. Could you suggest me the exact sql query.

Thanks in Advance,

Lavanya

In reply to Juan Leyva

Re: New plugin: Custom reports

by Daniel Nelson -
upgrading Moodle 2.2.x to 2.3.2+ and putting in the latest Config Reports plugin. We are Linux/Apache/Oracle. Getting this error. Table "block_configurable_reports_report" does not exist More information about this error Debug info: Error code: ddltablenotexist Stack trace: line 486 of /lib/ddl/database_manager.php: ddl_table_missing_exception thrown line 36 of /blocks/configurable_reports/db/upgrade.php: call to database_manager->rename_table() line 811 of /lib/upgradelib.php: call to xmldb_block_configurable_reports_upgrade() line 360 of /lib/upgradelib.php: call to upgrade_plugins_blocks() line 1524 of /lib/upgradelib.php: call to upgrade_plugins() line 329 of /admin/index.php: call to upgrade_noncore()
In reply to Juan Leyva

Re: New plugin: Custom reports

by Anil Sharma -

Thank you for this plugin, it works well with Moodle 2.3

I'm poor in MySQL so would really appricate if someone shared the custom SQL for this:

a. Total Login of students only from x date to y date

b. Total views by students only from x date to y date

c. Total time spent online by students only from x date to y date

I'm sure everyone needs these reports but I can't find these in the list of contributed reports here - http://docs.moodle.org/24/en/ad-hoc_contributed_reports

Thanks!

Anil

 

In reply to Anil Sharma

Re: New plugin: Custom reports

by roc mehra -

Hi All

I need to get total hits accross my site course wise from x date to y date. How can i get this?

When i use

SELECT COUNT(l.id) hits, l.course courseId, c.fullname coursename
FROM mdl_log l INNER JOIN mdl_course c ON l.course = c.id  
GROUP BY courseId
ORDER BY hits DESC

It gives me all hits. But i need according to some time then i have used this one

SELECT COUNT(l.id) hits, l.course courseId, c.fullname coursename
FROM mdl_log l INNER JOIN mdl_course c ON l.course =c.id where l.time BETWEEN 1324729113 AND 1324729220
GROUP BY courseId
ORDER BY hits DESC

But it will not display all the couses as the previous query return.

Any solution

In reply to Anil Sharma

Απάντηση: Re: New plugin: Custom reports

by George Chalatzoglidis -

I am looking for a user friendly plugin to export reports for:
student's
    total time spending online in a course
    total time spending online in an activity
from x date to y date

is this so difficult?

In reply to George Chalatzoglidis

Re: Απάντηση: Re: New plugin: Custom reports

by Sylvia Swanson -

There is a plugin called Timestat that does just that.

In reply to Juan Leyva

Re: New plugin: Custom reports

by Elizabeth Dalton -

Note - the link to documentation in the first post is now outdated and should be changed.

I have successfully created a sql report to show the last course access date by each enrolled student in a given course. At the Site level, I can use a course filter so I can see the results for one course. However, at the Course level, I still need to use the course filter and manually choose the course to restrict the results to that course. Is there a token to restrict SQL report results to the current course context? My code is below:

SELECT c.shortname AS CourseID, 
concat(u.lastname,', ',u.firstname ) AS Username,
u.email AS email,
( SELECT FROM_UNIXTIME(max(time)) FROM prefix_log as l WHERE course = c.id AND l.userid = u.id) AS LastActivity
FROM prefix_course AS c
JOIN prefix_context AS ctx ON c.id = ctx.instanceid
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id
JOIN prefix_user AS u ON u.id = ra.userid
WHERE ra.roleid =5
AND ctx.instanceid = c.id
In reply to Juan Leyva

Re: New plugin: Custom reports - problem with tokens

by Elizabeth Dalton -

I have created a SQL report which counts how many of various resources and activities are in each course. The report works as designed, but when I try to add a categories token, I get an error as soon as I select a category in the report.

My report SQL:

SELECT c.fullname AS Course
 
,(SELECT CONCAT(u.firstname,' ', u.lastname) AS Teacher
FROM prefix_role_assignments AS ra
JOIN prefix_context AS ctx ON ra.contextid = ctx.id
JOIN prefix_user AS u ON u.id = ra.userid
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher
 
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm
JOIN prefix_modules AS m ON cm.module = m.id
WHERE cm.course = c.id AND m.name LIKE '%forum%') AS Forums
 
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm
JOIN prefix_modules AS m ON cm.module = m.id
WHERE cm.course = c.id AND m.name LIKE '%quiz%') AS Quizzes
 
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm
JOIN prefix_modules AS m ON cm.module = m.id
WHERE cm.course = c.id AND m.name LIKE '%assignment%') AS Assignments

,(SELECT COUNT(prefix_page.id)
FROM prefix_page
JOIN prefix_course ON prefix_course.id = prefix_page.course WHERE c.id = prefix_page.course) AS 'HTML Pages'

,(SELECT COUNT(prefix_resource.id)
FROM prefix_resource
JOIN prefix_course ON prefix_course.id = prefix_resource.course WHERE c.id = prefix_resource.course) AS Files

,(SELECT COUNT(prefix_url.id)
FROM prefix_url
JOIN prefix_course ON prefix_course.id = prefix_url.course WHERE c.id = prefix_url.course) AS Links

,(SELECT FROM_UNIXTIME(MAX(prefix_resource.timemodified))
FROM prefix_resource
JOIN prefix_course ON prefix_course.id = prefix_resource.course WHERE c.id = prefix_resource.course AND prefix_resource.name LIKE '%syllabus%') AS 'Syllabus Updated'


FROM prefix_course AS c

%%FILTER_CATEGORIES:prefix_course.category%%

The error:

 

Debug info: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND mdl_course.category = 56
LIMIT 0, 5000' at line 40
SELECT c.fullname AS Course

,(SELECT CONCAT(u.firstname,' ', u.lastname) AS Teacher
FROM mdl_role_assignments AS ra
JOIN mdl_context AS ctx ON ra.contextid = ctx.id
JOIN mdl_user AS u ON u.id = ra.userid
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher

,(SELECT count( m.name ) AS count FROM mdl_course_modules AS cm
JOIN mdl_modules AS m ON cm.module = m.id
WHERE cm.course = c.id AND m.name LIKE '%forum%') AS Forums

,(SELECT count( m.name ) AS count FROM mdl_course_modules AS cm
JOIN mdl_modules AS m ON cm.module = m.id
WHERE cm.course = c.id AND m.name LIKE '%quiz%') AS Quizzes

,(SELECT count( m.name ) AS count FROM mdl_course_modules AS cm
JOIN mdl_modules AS m ON cm.module = m.id
WHERE cm.course = c.id AND m.name LIKE '%assignment%') AS Assignments

,(SELECT COUNT(mdl_page.id)
FROM mdl_page
JOIN mdl_course ON mdl_course.id = mdl_page.course WHERE c.id = mdl_page.course) AS 'HTML Pages'

,(SELECT COUNT(mdl_resource.id)
FROM mdl_resource
JOIN mdl_course ON mdl_course.id = mdl_resource.course WHERE c.id = mdl_resource.course) AS Files

,(SELECT COUNT(mdl_url.id)
FROM mdl_url
JOIN mdl_course ON mdl_course.id = mdl_url.course WHERE c.id = mdl_url.course) AS Links

,(SELECT FROM_UNIXTIME(MAX(mdl_resource.timemodified))
FROM mdl_resource
JOIN mdl_course ON mdl_course.id = mdl_resource.course WHERE c.id = mdl_resource.course AND mdl_resource.name LIKE '%syllabus%') AS 'Syllabus Updated'


FROM mdl_course AS c

AND mdl_course.category = 56
LIMIT 0, 5000
[array (
)]
Stack trace:
  • line 394 of /lib/dml/moodle_database.php: dml_read_exception thrown
  • line 848 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 48 of /blocks/configurable_reports/reports/sql/report.class.php: call to mysqli_native_moodle_database->get_recordset_sql()
  • line 80 of /blocks/configurable_reports/reports/sql/report.class.php: call to report_sql->execute_query()
  • line 67 of /blocks/configurable_reports/viewreport.php: call to report_sql->create_report()

The part I've marked in red seems to be the fail point. This works if I don't have multiple nested SELECT statements, but fails in this report.

Any suggestions?

In reply to Elizabeth Dalton

Re: New plugin: Custom reports - problem with tokens

by Kimber Warden -

Try changing your filter syntax from %%FILTER_CATEGORIES:prefix_course.category%%

to

%%FILTER_CATEGORIES:c.category%%

Average of ratings: Useful (1)
In reply to Juan Leyva

Re: New plugin: Custom reports

by Jason Hollowell -
Picture of Particularly helpful Moodlers

Juan or anyone who can help,

I used this under 1.9 sometime back and really enjoyed what it allowed but for some reason now when I tried to set it up and use it on 2.4+, I cannot get it to read from the database. I'm sure I'm missing something very simple but I've been banging away at it for a while now with no progress. Does anyone know what could be causing a databse read issue?

Hmm, well I cannot attach the image because I keep getting an

Invalid json error

message......all I'm getting today is error messages sad

I'm attaching a screen shot of the error I'm getting.

Jason

In reply to Jason Hollowell

Re: New plugin: Custom reports

by Jason Hollowell -
Picture of Particularly helpful Moodlers

Dear Juan & all,

Please ignore my previous message. I guess I was having a bad day. The problem originated from the fact that the name of the table I was trying to pull data from was misspelled. Oops! It is a table that I added to the Moodle database and have bar scan data being input to. I constructed my sql query using the correct spelling so, of course, the query wasn't executable because the table it was looking for doesn't exist. sad

When I changed the spelling in my query to match that of the table, everything worked. smile

Sorry for documenting my follies here.

Jason

In reply to Juan Leyva

Re: New plugin: Custom reports

by Alan Hare -

Juan,

Love the plugin.  Is it possible to add a tab to show the SQL/MySQL query that will be used for the report created?

Average of ratings: Useful (1)
In reply to Juan Leyva

Re: New plugin: Custom reports

by agung imannuel -

Hi Juan, i like your plugin. but i wanted to know can we add some bar chart in user report?

 

like in this link
http://docs.moodle.org/25/en/images_en/thumb/4/4c/block_custom_reports_sample_user_report.png/600px-block_custom_reports_sample_user_report.png

 

i don't want to use pie chart, i want to use bar chart, can we?

anyway, thanks and sorry for my English.

In reply to Juan Leyva

Re: New plugin: Custom reports - problem with logged in user id

by Sumit Gupta -

Hi Juan,

Thanks for such a great plg-in.

I was able to successfully download and install it and it works great. I am trying to create reports on how much time was spent on a given scorm package within a course. I was able use your custom SQL plug-in just fine and get those values from the database. However, I am stumbled upon an issue that I was show these times for individual "students". Basically, how do I add the current logged user's id in the 'where' clause of the SQL query? I did that you have filers in there but I cannot show other's data to a given user. So, I need to show the data pre-filtered based on current logged user id.
 
Can you please point me in the right direction on how to achieve it? I will really appreciate your help. 
 
Thanks,
Sumit
In reply to Sumit Gupta

Re: New plugin: Custom reports - problem with logged in user id

by Sumit Gupta -

I was able to figure this out. The logged in user id can be grabbed using the token %%USERID%% in the custom sql query.

In reply to Sumit Gupta

Re: New plugin: Custom reports - problem with logged in user id

by Sandeep Kankatala -

Hi Sumit,

Just wondering how did you calculate the Course Dedication time in a custom SQL query?

I am unable to find the formula so that I can include in my custom SQL query.

Any ideas?

 

TIA.

 

In reply to Juan Leyva

Re: New plugin: Custom reports

by jeff james -

Hi,

When I enable the template from the "Template" tab, I see the "Download Report xls" link seems to disappear from the "View Report" tab.

Is there any way of keeping both options on the "View Report" tab, with the Download link just ignoring the template and the Print report using the template?

Cheers

Jeff

In reply to Juan Leyva

Re: New plugin: Custom reports

by Peter Kehl -

Juan (or anyone maintaining this),

following are a few fixes for configurable_reports 2.2 (2011040105), needed for Postgres and MS SQL and in order for PHP not to generate warnings. It's only for parts that I've used. Please, include them in your next release.

index 5c42050..ede81bd 100644
--- a/components/conditions/usersincurrentcourse/plugin.class.php
+++ b/components/conditions/usersincurrentcourse/plugin.class.php
@@ -42,7 +42,7 @@ class plugin_usersincurrentcourse extends plugin_base{
                global $DB;
        
                $context = get_context_instance(CONTEXT_COURSE,$courseid);
-               if($users = get_role_users($data->roles, $context, false, 'u.id')){
+               if($users = get_role_users($data->roles, $context, false, 'u.id', 'u.id')){
                        return array_keys($users);
                }
                
diff --git a/components/filters/fcoursefield/plugin.class.php b/components/filters/fcoursefield/plugin.class.php
index e1951e1..b942f91 100644
--- a/components/filters/fcoursefield/plugin.class.php
+++ b/components/filters/fcoursefield/plugin.class.php
@@ -38,7 +38,7 @@ class plugin_fcoursefield extends plugin_base{
        }
        
        function execute($finalelements,$data){
-               
+               global $DB;
                $filter_fcoursefield = optional_param('filter_fcoursefield_'.$data->field,0,PARAM_RAW);         
                if($filter_fcoursefield){
                        // addslashes is done in clean param
@@ -71,11 +71,13 @@ class plugin_fcoursefield extends plugin_base{
                $reportclass = new $reportclassname($this->report);
                                
                $components = cr_unserialize($this->report->components);                
-               $conditions = $components['conditions'];
+               $conditions = isset($components['conditions'])
+                       ? $components['conditions']
+                       : array();
                $courselist = $reportclass->elements_by_conditions($conditions);
                                
                if(!empty($courselist)){
-                       if($rs = $DB->get_recordset_sql('SELECT DISTINCT('.$data->field.') as ufield FROM {course} WHERE '.$data->field.' <> "" ORDER BY ufie
+                       if($rs = $DB->get_recordset_sql('SELECT DISTINCT('.$data->field.') as ufield FROM {course} WHERE '.$data->field." <> '' ORDER BY ufie
                                foreach($rs as $u){
                                        $filteroptions[base64_encode($u->ufield)] = $u->ufield;
                                }

 

In reply to Juan Leyva

Re: New plugin: Custom reports

by Tim Roper -

Hi

It's a great addin but I have a repeated error:

Function get_all_mods() is deprecated. Use get_fast_modinfo() and get_module_types_names() instead. See phpdocs for details

  • line 2970 of /lib/deprecatedlib.php: call to debugging()
  • line 45 of /blocks/configurable_reports/components/columns/usermodactions/form.php: call to get_all_mods()
  • line 191 of /lib/formslib.php: call to usermodactions_form->definition()
  • line 143 of /blocks/configurable_reports/editplugin.php: call to moodleform->moodleform()

Looks like a database error but can you advise?

Thanks

In reply to Tim Roper

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi,

this is not an error, is a notice because you have choose to display developer messages in your Administrations / Development / Settings. Please, uncheck the option "display errors" in that page.

In any case, this message doesn't appear in the last version of the plugin, so I suggest you to upgrade to the last version you can found in moodle.org/plugins

Regards

In reply to Juan Leyva

Re: New plugin: Custom reports

by Toni Soto -

Hi Juan,

Yesterday I upgraded from moodle 5.2.1 to 5.2.3 and re-activated configurable_report again. I noticed that in debugging mode a message appears in every course frontpage with a visible configurable_reports block:

Warning: First parameter must either be an object or the name of an existing class in /var/www/moodle/blocks/configurable_reports/block_configurable_reports.php on line 124

It only appears at the frontpage of those courses but when I move to the block to work with it (building reports, view them,...) the message goes away.

I also noticed that cron stops when executing the configurable_report task reporting this error message:

Starting blocks
Processing cron function for configurable_reports....... started 12:58:55. Current memory use 47.9MB.
!!! La tabla "blocks"no existe !!!
!! 
Error code: ddltablenotexist !!
!! Stack trace: * line 554 of /lib/dml/moodle_database.php: dml_exception thrown
* line 1429 of /lib/dml/moodle_database.php: call to moodle_database-&gt;where_clause()
* line 159 of /blocks/configurable_reports/block_configurable_reports.php: call to moodle_database-&gt;get_field()
* line 300 of /lib/cronlib.php: call to block_configurable_reports-&gt;cron()
* line 88 of /admin/cron.php: call to cron_run()
 !!

I'm not programmer but I could track the source of the error to line 159 in  block_configurable_reports.php :

        $lastcron = $DB->get_field('blocks', 'lastcron', array('name' => 'configurable_reports'));

Changing blocks to block seems to sort it out the cron problem but It will be safer if you can confirm it.

Best regards form Vigo!

Toni

 

In reply to Toni Soto

Re: New plugin: Custom reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Tony,

thanks for your contribution listing the errors you've found.

I fixed both of them (the first one was fixed some days ago)

And the second one is here https://github.com/jleyva/moodle-block_configurablereports/commit/d4d12bb9653c1079cd4afbcc7be8f1bed555034d

I'm going to release a new version because the cron bug is very dangerous

Regards

In reply to Juan Leyva

Re: New plugin: Custom reports

by Mykl Belfatto -
Hey Juan, excellent plugin,
I have a question re: filtering...
I have a JOIN BETWEEN in my SQL and I want to use the Date From To Filter.  Do you know how I can do this?
Here's my SQL


SELECT data AS 'Company', u.firstname AS 'First' , u.lastname AS 'Last', c.fullname AS Course, cc.name AS 'Category', CASE WHEN gi.itemtype = 'course' THEN CONCAT(c.fullname, ' - Total') ELSE gi.itemname END AS 'Item Name', ROUND(gg.finalgrade,2) AS Grade, FROM_UNIXTIME(gg.timemodified, '%D %M %Y') AS 'Date' FROM mdl_user_info_data AS ui JOIN mdl_user AS u ON u.id = ui.id JOIN mdl_grade_grades AS gg ON gg.userid = u.id AND gg.timemodified BETWEEN 1398902400 AND 1401580800

JOIN mdl_grade_items AS gi ON gi.id = gg.itemid JOIN mdl_course AS c ON c.id = gi.courseid JOIN mdl_course_categories AS cc ON cc.id = c.category WHERE ui.data != '' ORDER BY company, Lastname, firstname, Course


In reply to Juan Leyva

Re: New plugin: Custom reports

by Michael E -
Picture of Core developers Picture of Testers

Hi Juan,

We are using your plug-in quite extensively and it's great.

Since the last upgrade to the latest version of configurable reports, we are unable to put a search filter on reports which do not have JavaScript enabled.

We are using this syntax in the SQL:

%%FILTER_SEARCHTEXT:u.lastname%%

 

And here is the error we are getting:

error/nosuchoperator

More information about this error

Debug info:
Error code: nosuchoperator
$a contents:
Stack trace:
  • line 463 of /lib/setuplib.php: moodle_exception thrown
  • line 54 of /blocks/configurable_reports/components/filters/searchtext/plugin.class.php: call to print_error()
  • line 134 of /blocks/configurable_reports/reports/sql/report.class.php: call to plugin_searchtext->execute()
  • line 69 of /blocks/configurable_reports/viewreport.php: call to report_sql->create_report()

 

What are we doing wrong?

Average of ratings: Useful (1)
In reply to Juan Leyva

Re: New plugin: Custom reports

by arjun mishra -

how to use php files in moodle...is that any component used ya module.

In reply to Juan Leyva

Re: New plugin: Custom reports

by Deb W -

Need help!  smile

I have no SQL programming experience, and am trying to set up a customizable report.  I need to return only those records where the grade > 7.9.  I also need to add two custom user fields:  County and State.  I'm attaching a file with my code.

 

In reply to Deb W

Re: New plugin: Custom reports

by Peter Bowen -

Hi Deb,

For the grade,  add the line "AND gg.finalgrade>7.9" to the end of the JOIN of the grade.

To add the custom user fields, you need to find out what fieldid moodle assigned the custom field to. This is held in the table mdl_user_info_field.

Once you have that, you can use the following code:

JOIN prefix_user_info_data AS aa
ON u.ID = aa.userid AND aa.fieldid=9

In this example, aa.data will contain the information for custom field 9, which in our case is the Position Description.

To pull a second field, use

JOIN prefix_user_info_data AS ab
ON u.ID = ab.userid AND ab.fieldid=5

And again, ab.data will contain the information.

So your code (once we know the correct fieldid's is:

SELECT  u.firstname AS 'First' , u.lastname AS 'Last',  aa.data AS 'Country', ab.data AS 'State',

CASE
  WHEN gi.itemtype = 'course'
   THEN CONCAT(c.fullname, ' - Total')
  ELSE gi.itemname
END AS 'Item Name',
 
ROUND(gg.finalgrade,2) AS Grade,
FROM_UNIXTIME(gg.timemodified) AS TIME
 
FROM prefix_course AS c
JOIN prefix_context AS ctx ON c.id = ctx.instanceid
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id
JOIN prefix_user AS u ON u.id = ra.userid
JOIN prefix_user_info_data AS aa
ON u.ID = aa.userid AND aa.fieldid=9
JOIN prefix_user_info_data AS ab
ON u.ID = ab.userid AND ab.fieldid=9
JOIN prefix_grade_grades AS gg ON gg.userid = u.id AND gg.finalgrade>7.9
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid
JOIN prefix_course_categories AS cc ON cc.id = c.category
 
WHERE  gi.courseid = c.id
ORDER BY lastname

 

Cheers
Peter

 

In reply to Peter Bowen

Re: New plugin: Custom reports

by Andrew Nokes -

Hi Peter,

I too have very little experience with SQL and was hoping you (or someone else on this thread) might be able to assist?

I have a similar need to Deb's.  I am trying to create a customisable report that simply replicates the Course Completion report (found in the Course Completion block), but with the addition of some custom user profile fields. So the columns would be:

  • idnumber
  • firstname
  • lastname
  • profile_field_employmenttype  (Custom user profile field)
  • department
  • profile_field_dept  (Custom user profile field)
  • profile_field_subsection  (Custom user profile field)
  • profile_field_section (Custom user profile field)
  • profile_field_directorate (Custom user profile field)
  • Course completion date
  • Course completion status

 

Any help would be greatly appreciated!

Thanks,

Andrew

In reply to Andrew Nokes

Re: New plugin: Custom reports

by Deb W -

Hey Andrew,


Try this:

SELECT  u.firstname AS 'First' , u.lastname AS 'Last',  aa.data AS 'State', ab.data AS 'County', ac.data AS 'Gender', ad.data AS 'Ethnicity', ae.data AS 'Race', af.data AS 'Residence', ag.data AS 'Grade in School',

CASE
  WHEN gi.itemtype = 'course'
   THEN CONCAT(c.fullname, ' - Total')
  ELSE gi.itemname
END AS 'Item Name',
 
ROUND(gg.finalgrade,2) AS Grade,
FROM_UNIXTIME(gg.timemodified) AS TIME

 
FROM prefix_course AS c
JOIN prefix_context AS ctx ON c.id = ctx.instanceid
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id
JOIN prefix_user AS u ON u.id = ra.userid

JOIN prefix_user_info_data AS aa
ON u.ID = aa.userid AND aa.fieldid=1

JOIN prefix_user_info_data AS ab
ON u.ID = ab.userid AND ab.fieldid=2

JOIN prefix_user_info_data AS ac
ON u.ID = ac.userid AND ac.fieldid=3

JOIN prefix_user_info_data AS ad
ON u.ID = ad.userid AND ad.fieldid=4

JOIN prefix_user_info_data AS ae
ON u.ID = ae.userid AND ae.fieldid=5

JOIN prefix_user_info_data AS af
ON u.ID = af.userid AND af.fieldid=6

JOIN prefix_user_info_data AS ag
ON u.ID = ag.userid AND ag.fieldid=7

JOIN prefix_grade_grades AS gg ON gg.userid = u.id AND gg.finalgrade>10 and gg.finalgrade<100
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid
JOIN prefix_course_categories AS cc ON cc.id = c.category
 
WHERE  gi.courseid = c.id
ORDER BY Last

In reply to Deb W

Re: New plugin: Custom reports

by Andrew Nokes -

Thanks Deb,

Seems to be pulling the right kind of info smile

I even managed to change the column titles and add the idnumber column.


A couple of issues though...

1) The report is returning course completions for all courses across the site.  How can I restrict this so the report only returns course completions for one course? (the course which the configurable report block is added)

2) The report is  returning 896 records which is not the full number records I was expecting,

3) I'm getting a lot of duplicated records in the report, by up to 4 times.


Any ideas?


Cheers,

Andrew


Here's my current code:

SELECT  u.idnumber AS 'ID' , u.firstname AS 'First' , u.lastname AS 'Last',  aa.data AS 'Employment Type', ab.data AS 'Department', ac.data AS 'Dept', ad.data AS 'Sub Section', ae.data AS 'Section', af.data AS 'Directorate', ag.data AS 'Area', 


CASE 

  WHEN gi.itemtype = 'course' 

   THEN CONCAT(c.fullname, ' - Total')

  ELSE gi.itemname

END AS 'Item Name',

 

ROUND(gg.finalgrade,2) AS Grade,

FROM_UNIXTIME(gg.timemodified) AS TIME


 

FROM prefix_course AS c

JOIN prefix_context AS ctx ON c.id = ctx.instanceid

JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id

JOIN prefix_user AS u ON u.id = ra.userid


JOIN prefix_user_info_data AS aa

ON u.ID = aa.userid AND aa.fieldid=1


JOIN prefix_user_info_data AS ab

ON u.ID = ab.userid AND ab.fieldid=2


JOIN prefix_user_info_data AS ac

ON u.ID = ac.userid AND ac.fieldid=3


JOIN prefix_user_info_data AS ad

ON u.ID = ad.userid AND ad.fieldid=4


JOIN prefix_user_info_data AS ae

ON u.ID = ae.userid AND ae.fieldid=5


JOIN prefix_user_info_data AS af

ON u.ID = af.userid AND af.fieldid=6


JOIN prefix_user_info_data AS ag

ON u.ID = ag.userid AND ag.fieldid=7


JOIN prefix_grade_grades AS gg ON gg.userid = u.id AND gg.finalgrade>10 and gg.finalgrade<100

JOIN prefix_grade_items AS gi ON gi.id = gg.itemid

JOIN prefix_course_categories AS cc ON cc.id = c.category

 

WHERE  gi.courseid = c.id 

ORDER BY Last

In reply to Andrew Nokes

Re: New plugin: Custom reports

by Deb W -
I'm learning most decidedly that I'm not a SQL programmer!  smile  I'm not sure how to answer your questions...only know that I'm likely to start running into the same problem.  Currently we only have one course on the site, but will be starting the process of adding more tomorrow.  ....so hopefully someone can solve our problem! 
In reply to Peter Bowen

Re: New plugin: Custom reports

by Deb W -

Hey Peter!

So your code is working fabulously, but now I have way too many records.  How can I filter for a specific course, specified start and end time, filter for a state, and also include more than 5000 records? It sounds like the last request may be the hardest, so maybe I'll just focus on the first two!   smile 


SELECT  u.firstname AS 'First' , u.lastname AS 'Last',  ab.data AS 'State', aa.data AS 'County',

CASE
  WHEN gi.itemtype = 'course'
   THEN CONCAT(c.fullname, ' - Total')
  ELSE gi.itemname
END AS 'Item Name',
 
ROUND(gg.finalgrade,2) AS Grade,
FROM_UNIXTIME(gg.timemodified) AS TIME
 
FROM prefix_course AS c
JOIN prefix_context AS ctx ON c.id = ctx.instanceid
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id
JOIN prefix_user AS u ON u.id = ra.userid
JOIN prefix_user_info_data AS aa
ON u.ID = aa.userid AND aa.fieldid=2
JOIN prefix_user_info_data AS ab
ON u.ID = ab.userid AND ab.fieldid=1
JOIN prefix_grade_grades AS gg ON gg.userid = u.id AND gg.finalgrade>7.9 AND gg.finalgrade<99
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid
JOIN prefix_course_categories AS cc ON cc.id = c.category
 
WHERE  gi.courseid = c.id
ORDER BY lastname

In reply to Juan Leyva

Re: New plugin: Custom reports

by Anastasia Robey -

Hi,

We have been using this block for our courses for some time and it has provided us with the reporting functionality we needed for most of that time.  However, we're seeing some issues with time tracking on configurable reports that we really need to clear up.

We've noticed recently that the time tracking on our reports is inaccurate and we cannot pinpoint the reason.  The time shown for each user in the course also seems to change randomly; for instance, we had one user who had spent over seven hours in one course when we checked the report towards the end of March, but now the user is showing 0 time spent, which is definitely incorrect as they have completed both parts of the course.

Searching through the user data is not giving us any helpful information.  Does anyone have pointers that would allow us to troubleshoot this feature on our reports?  Thanks!

In reply to Anastasia Robey

Re: New plugin: Custom reports

by Randy Thornton -
Picture of Documentation writers

Anastasia,

Yes, I would add onto the report the raw times from the relevant columns in addition to the formatted ones. You want to be able to isolate if this is a something in the raw time in the database (presumably in mdl_log and probably mdl_log.time), or is it in the way the date is formatted in the report, or a possible math issue in between.

Randy

In reply to Juan Leyva

Re: New plugin: Custom reports

by Andrew Nokes -

Hi,

 

I have very little experience with SQL and was hoping someone on might be able to help...

I am trying to create a configurable report that simply replicates the Course Completion report (found in the Course Completion block) for a single course, but with the addition of some custom user profile fields.  So the columns would be:

 

  • idnumber
  • firstname
  • lastname
  • profile_field_employmenttype(Custom user profile field)
  • department
  • profile_field_dept(Custom user profile field)
  • profile_field_subsection(Custom user profile field)
  • profile_field_section (Custom user profile field)
  • profile_field_directorate (Custom user profile field)
  • Course completion date
  • Course completion status

 

The SQL I currently have seems to be pulling the right kind of info but there are issues...

 

1) The report is returning course completions for all courses across the site.  How can I restrict this so the report only returns course completions for one course? (the course where I add the configurable report block)

 

2) The report is returning 896 records which is not the full number records I am expecting,

 

3) I'm getting a lot of duplicated records in the report, by up to 4 times.

 

Here's my current code:

 

SELECT  u.idnumber AS 'ID' , u.firstname AS 'First' , u.lastname AS 'Last',  aa.data AS 'Employment Type', ab.data AS 'Department', ac.data AS 'Dept', ad.data AS 'Sub Section', ae.data AS 'Section', af.data AS 'Directorate', ag.data AS 'Area',

 

CASE

  WHEN gi.itemtype = 'course'

   THEN CONCAT(c.fullname, ' - Total')

  ELSE gi.itemname

END AS 'Item Name',

 

ROUND(gg.finalgrade,2) AS Grade,

FROM_UNIXTIME(gg.timemodified) AS TIME

 

 

FROM prefix_course AS c

JOIN prefix_context AS ctx ON c.id = ctx.instanceid

JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id

JOIN prefix_user AS u ON u.id = ra.userid

 

JOIN prefix_user_info_data AS aa

ON u.ID = aa.userid AND aa.fieldid=1

 

 

JOIN prefix_user_info_data AS ab

ON u.ID = ab.userid AND ab.fieldid=2

 

JOIN prefix_user_info_data AS ac

ON u.ID = ac.userid AND ac.fieldid=3

 

JOIN prefix_user_info_data AS ad

ON u.ID = ad.userid AND ad.fieldid=4

 

JOIN prefix_user_info_data AS ae

ON u.ID = ae.userid AND ae.fieldid=5

 

JOIN prefix_user_info_data AS af

ON u.ID = af.userid AND af.fieldid=6

 

JOIN prefix_user_info_data AS ag

ON u.ID = ag.userid AND ag.fieldid=7

 

JOIN prefix_grade_grades AS gg ON gg.userid = u.id AND gg.finalgrade>10 and gg.finalgrade<100

JOIN prefix_grade_items AS gi ON gi.id = gg.itemid

JOIN prefix_course_categories AS cc ON cc.id = c.category

 

WHERE  gi.courseid = c.id

ORDER BY Last

 

Any help would be greatly appreciated!

 

Thanks,

Andrew

In reply to Andrew Nokes

Re: New plugin: Custom reports

by Peter Bowen -

Hi Andrew,

Funny, I saw the aa.data or ab.data and thought that is my coding.... Then I spotted my post further up...


I suspect you are hitting your 5000 limit with the merges etc.


Try moving

JOIN prefix_grade_grades AS gg ON gg.userid = u.id AND gg.finalgrade>10 and gg.finalgrade<100

JOIN prefix_grade_items AS gi ON gi.id = gg.itemid

JOIN prefix_course_categories AS cc ON cc.id = c.category

 

to above the 

JOIN prefix_user_info_data AS aa

ON u.ID = aa.userid AND aa.fieldid=1


and move the WHERE gi.courseid=c.id to 


JOIN prefix_grade_items AS gi ON gi.id = gg.itemid AND gi.courseid=c.id


This will filter at the join stage, rather than bring it all in and then get rid of unnecessary lines.


If you still end up with duplicates, which is possible, dry using a SELECT DISTINCT instead of SELECT.


Hope this helps.


Cheers
Peter

In reply to Juan Leyva

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Juan Leyva

Re: New plugin: Custom reports

by Lawrence Luna -

Hello,


Thank you for your plugin, it's very useful and works great.  I use it like this.

SELECT g.name AS groupname, c.shortname AS coursename, mu.username, CONCAT(mu.lastname, ', ',mu.firstname) AS fullname, gg.finalgrade AS finalgrade 
FROM prefix_grade_items AS gi 
INNER JOIN prefix_course c ON c.id = gi.courseid 
LEFT JOIN prefix_grade_grades AS gg ON gg.itemid = gi.id 
INNER JOIN prefix_user AS mu ON gg.userid = mu.id 
LEFT JOIN prefix_groups_members AS gm ON mu.id = gm.userid 
LEFT JOIN prefix_groups AS g ON gm.groupid = g.id 
WHERE gi.itemtype = 'course' 
%%FILTER_COURSES:l.course%% 
ORDER BY g.id desc


I wanted to add a filter for the groups if possible, can you help me?

I want it to be filtered so that they can choose to view the overall grades of students that are in this group only etc.


Thank you,

In reply to Lawrence Luna

Re: New plugin: Custom reports

by Lawrence Luna -

Hello,

I have improved my SQL and did this instead.

SELECT
	groups.name AS "Group",
	users.username, 
	CONCAT(users.lAStname, ', ',users.firstname) AS "Full Name",
	courses.fullname AS "Course Name",
	ROUND(grades.finalgrade, 2) AS "Total Grade",
	CASE 
		WHEN grades.finalgrade > 90 THEN 'Excellent'
		WHEN grades.finalgrade > 70 THEN 'PASsed'
		WHEN grades.finalgrade > 0  THEN 'Failed'
		WHEN grades.finalgrade = 0  THEN 'Incomplete'
     ELSE 'N/A'
	END AS "Remarks"
FROM prefix_user AS users
INNER JOIN prefix_grade_grades AS grades ON grades.userid = users.id
LEFT OUTER JOIN prefix_grade_items AS gradeitems ON grades.itemid = gradeitems.id AND gradeitems.itemtype = 'course'
INNER JOIN prefix_course AS courses ON courses.id = gradeitems.courseid
LEFT OUTER JOIN prefix_groups_members AS groupmembers ON users.id = groupmembers.userid
LEFT OUTER JOIN prefix_groups AS groups ON groupmembers.groupid = groups.id AND courses.id = groups.courseid
WHERE 1=1
%%FILTER_COURSES:courses.id%%
%%FILTER_SEARCHTEXT:groups.name:~%%
ORDER BY groups.name, courses.sortorder, users.lAStname ASC

Right now, I can filter by group by using the search text filter. The drawback is you have to know the name of the group. I hope that there is a group filter instead.


Any improvement is welcome/ Thank you.

In reply to Juan Leyva

Re: New plugin: Custom reports

by Gayle Bird -
This is an amazing plugin which I've loved for years on 2.2. THANK YOU for spending your time not only creating such useful work and sharing it, but actually replying to people's questions and helping them use it!


Today I tried to make a new report and got it all set up, but the View Report screen was just blank. I assumed it was too much data so I tried to go to Conditions but THAT page is blank. Creating a new report with almost no data comes up the same. Already-created reports ARE viewable but some of their editing pages are blank now, too. It is inconsistent. 


Is my server just full of data or is something up with the installation? How do I tell? 

In reply to Juan Leyva

Re: New plugin: Custom reports

by ashkan ksh -

Hello Juan and thank you for your wonderful plugin.


I need to use this plugin for generating some report, but I have issue in using this plugin for persian language. When I'm using the sql queries and alias count columns to persian words, I will seen ???? characters. And after checking codes I see you are using serialize function and I couldn't know how I can use persian as column name.

You can see my screen shot for find issue.


Thank you for your help.

Attachment issue.PNG
In reply to ashkan ksh

Re: New plugin: Custom reports

by Miguel González Laredo -
Picture of Plugin developers

Hello. We're also hopeful with that insteresting plugin! Thanks  Juan

 Dear Ashkan, we've found some of your overlapping problems on column headers. Anyone knowing wordaround about it?


 Miguel

In reply to Juan Leyva

Re: New plugin: Custom reports

by Stefan Dobrin Predescu -

Thanks for the plugin. You did an excellent job.

I would like to ask if it would be possible, to have a kind of report on Moodle, where users be the ones to introduce manually, the necessary data.

 

I would like to use Moodle to train a sales force, and I know that it is possible. But I wonder if it would be possible to let each sales reps to enter a daily activity report. Then to centralize these data as reports, while providing access to different hierarchical people as managers, executives, etc.

 

I think that should be a mixture of survey and report, where users input the necessary data as in a survey and be centralize and expose them through different graphs, tables, with the possibility of downloading them, etc.

 

There is something like that in Moodle or would be possible to create such a plugin?

 

I do not know if I'm on the right topic, but I think I speak to the right people. Any information in this regard is highly appreciated. Thank you.


In reply to Stefan Dobrin Predescu

Re: New plugin: Custom reports

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I think the database activity would probably do the majority of what you want...or possibly the feedback module?

In reply to Juan Leyva

Re: New plugin: Custom reports

by tim st.clair -
Picture of Plugin developers

I'm trying to report on user completions for a particular auth type. I've added a 'User field filter' and specified the 'auth' column which shows the filter itself (distinct column values, plus an 'all' option). Initially this seems broken since if I select anything from the list and submit, it then selects the last item from that list and won't change back to anything else.

I'm also unsure of what filter value to incorporate into my report, which is currently as follows:

SELECT u.username, u.email, c.shortname,  u.auth,
DATE_FORMAT(FROM_UNIXTIME(p.timecompleted
),'%Y-%m-%d %H:%i:%s') 
AS completed
FROM prefix_course_completions AS p
JOIN prefix_course AS c ON p.course = c.id
JOIN prefix_user AS u ON p.userid = u.id
WHERE c.enablecompletion = 1
%%FILTER_COURSES:c.id%%
%%FILTER_STARTTIME:p.timecompleted:>=%%
%%FILTER_ENDTIME:p.timecompleted:<=%%
ORDER BY u.email

https://github.com/jleyva/moodle-custom_sql_report_queries/blob/master/sql_snippets/filters_and_variables.sql and http://opensourceelearning.blogspot.com.au/2015/08/moodle-configurable-reports-plugin-all.html have been slightly informative on how filter values can be used, but I can't see how this can be used to incorporate the user auth field.


In reply to Juan Leyva

Re: New plugin: Custom reports

by Alejandro Piñango -

Hola juan, tremenda herramienta, felicitaciones.

 

Al intentar hacer un reporte y escoger la opción Acciones de módulo de usuario, el sistema me gera este error. Estoy usando moodle 3.1.1.

 

Lo probé en Moodle 3.0.2 y da el mismo error.

 

Cómo podría solucionarlo?

 

Muchas gracias.

 

Detectado un error de codificación, debe ser corregido por un programador: Function get_all_mods() is removed. Use get_fast_modinfo() and get_module_types_names() instead. See phpdocs for details

Más información sobre este error

×Debug info: 
Error code: codingerror
×Stack trace:
  • line 1273 of \lib\deprecatedlib.php: coding_exception thrown
  • line 46 of \blocks\configurable_reports\components\columns\usermodactions\form.php: call to get_all_mods()
  • line 201 of \lib\formslib.php: call to usermodactions_form->definition()
  • line 149 of \blocks\configurable_reports\editplugin.php: call to moodleform->__construct()
In reply to Alejandro Piñango

Re: New plugin: Custom reports

by Are Prashanth Reddy -

Hi Juan, 

Looks like your plugin is not compatible with Moodle 3.2 (PHP 7) version. Is there any chance that you make this plugin compatible with latest version of Moodle.

In a page am getting this error

"Coding error detected, it must be fixed by a programmer: Function get_all_mods() is removed. Use get_fast_modinfo() and get_module_types_names() instead. See phpdocs for details "

In reply to Are Prashanth Reddy

Re: New plugin: Custom reports

by Ibrahim Fadl -

Hi Juan,

In my select query e.g.

Select u.firstname AS Firstname

FROM prefix_user AS u


When viewing the report the column title Firstname is not capitalized for letter "F"

Thank you