Page 1 of 1
Help needed in Reports
PostPosted:Fri Nov 25, 2011 5:05 am
by raths
hello all
I need help in reporting . Can any one give me a XML code that will give the report of the 'Name of documents uploaded by a user in one month ' ?
Regards
Rathnavel
Re: Help needed in Reports
PostPosted:Fri Nov 25, 2011 2:37 pm
by jllort
Take a look here
http://wiki.openkm.com/index.php/Reports ( are two examples )
I think the most easiest way for doing it to you, is making some sql query to OKM_ACTIVITY table
Re: Help needed in Reports
PostPosted:Wed Feb 01, 2012 1:45 pm
by Sascha
Hello okm'ers,
I am trying to implement the simple report example (RegisterdUsers.jrxml) from the wiki. after importing and executing it, there is no result. When I open the report I get this error:
Code: Select allClass: net.sf.jasperreports.engine.JRException
Message: Errors were encountered when compiling report expressions class file: 1. Cannot cast from Date to String value = (java.lang.String)(new Date()); //$JR_EXPR_ID=8$ <----------------------------> 2. Cannot cast from Date to String value = (java.lang.String)(new Date()); //$JR_EXPR_ID=9$ <----------------------------> 3. Cannot cast from Date to String value = (java.lang.String)(new Date()); //$JR_EXPR_ID=8$ <----------------------------> 4. Cannot cast from Date to String value = (java.lang.String)(new Date()); //$JR_EXPR_ID=9$ <----------------------------> 5. Cannot cast from Date to String value = (java.lang.String)(new Date()); //$JR_EXPR_ID=8$ <----------------------------> 6. Cannot cast from Date to String value = (java.lang.String)(new Date()); //$JR_EXPR_ID=9$ <----------------------------> 6 errors
Date: Wed Feb 01 13:45:44 CET 2012
I use Aqua Data Studio vor editing the .jrxml-files. With this tool I also generate an .jasper-file, but there is also no result. That means the PDF, Rich-Text, CSV-files are empty.
My first question is how to get the example to run. Maybe someone knows what the error means.
Secondly I need to know, how I can get the database relationship-model for scripting some custom reports.
Best regards
Sascha
Re: Help needed in Reports
PostPosted:Thu Feb 02, 2012 9:38 am
by jllort
Error is clear, you've got Date date and want to represent in String field you should represent in Date field with some pattern if not must convert Date to String as $date.getYear + ":" $date.getMonth as String value etc.... but i recommend use Date field to represent it ( you can change the type from java.lang.String to Date )
Re: Help needed in Reports
PostPosted:Fri Feb 03, 2012 7:53 am
by Sascha
Hello okm'ers,
thanks to jllort for the helping post. I had remove the "date"-code and then it worked.
Furthermore the font "arial" must be replaced by for example "sanserif", because it´s not installed on my linux system.
Thanks for releasing 5.1.9. I will test it soon.
Re: Help needed in Reports
PostPosted:Fri Feb 03, 2012 8:11 am
by Sascha
Hello okm'ers,
now I want to setup some more complex reports. In the example below you had use some java DAO´s. I couldn´t find an object for something like "getUploadedFiles" in the DAO-Package
http://doxygen.openkm.com/5.0.x/dc/d57/ ... _1dao.html
Do you know "on-the-fly" if there is something like this implemented. I need a report where the user or a group is listed in one row with his uploaded files since the last week (or since yesterday,...). Perhaps it is implemented in the UserItemsDAO, but I don´t know how to extract it right.
Code: Select all
usr.put("id", user.getId());
usr.put("name", user.getName());
usr.put("email", user.getEmail());
usr.put("roles", user.getRoles().toString());
#########for examle###########
usr.put("uploaded", user.getUploadedFiles().toString());
#############################
Re: Help needed in Reports
PostPosted:Fri Feb 03, 2012 4:38 pm
by pavila
You can use OKMDashboard.getLastUploadedDocuments() method to get a list of the last uploaded documents.
Re: Help needed in Reports
PostPosted:Sat Feb 04, 2012 1:27 pm
by Sascha
Hi okm'ers,
thank you very much for the fast help. Now I know, where to find the right DAO's.
My case wents more complex.The report should fire up a query that looks for users that are legitimated to a special directory-structure. Than this users become an report by email about the dailly processes ( means document-updates / new documents listed ).
I hope it clear what I mean?! My question is how could this be implemented in the script and is it necessary to use a cron for the dailly, weekly,... requirement? What method is recommended for the mailing to custom users?
Thanks
Sascha
Re: Help needed in Reports
PostPosted:Wed Feb 08, 2012 5:21 pm
by pavila
If you want to repeat a task, use the Crontab (
http://wiki.openkm.com/index.php/Crontab). This way you can implement a class which send a report the several users every certain time. To send a email you can use the MailUtils class.