Difference between revisions of "Reports"

From OpenKM Documentation
Jump to: navigation, search
Line 1: Line 1:
In Report view you can uploading your own jasper reports. Reports are in [[wikipedia:PDF|PDF]] format.
+
{{TOCright}} __TOC__
 +
 
 +
In report section you can create and use your own Jasper Reports. Reports are generated in [[wikipedia:PDF|PDF]] format. Starting from OpenKM 5.1 other formats can be generated.
  
  
Line 14: Line 16:
 
Report can use internally Scripting or SQL. The file to uploading must be '''.jrxml''' JasperReport source file. Starting with OpenKM 5.1 you can also upload compiled reports (files with '''.jasper''' extension).
 
Report can use internally Scripting or SQL. The file to uploading must be '''.jrxml''' JasperReport source file. Starting with OpenKM 5.1 you can also upload compiled reports (files with '''.jasper''' extension).
  
 +
== SQL Report ==
 +
Usually you can have a database and want to generate a report extracting data from it. In this case you should know the table relationship. Tools like [http://www.aquafold.com/ Aqua Data Studio] can help you to create a
  
== XPath query ==
+
== Script Report ==
 +
== XPath Report ==
 
If you want to create a report which uses an XPath query, use scripting to do the trick. This code will query for locked documents:
 
If you want to create a report which uses an XPath query, use scripting to do the trick. This code will query for locked documents:
  
Line 46: Line 51:
 
</source>
 
</source>
  
You can finde the whole report at [[File:LockedDocuments.jrxml]].
+
You can finde the whole report at [[File:LockedDocuments.jrxml]] and [[File:SubscribedDocuments.jrxml]].
 
[[Category: Administration Guide]]
 
[[Category: Administration Guide]]

Revision as of 15:06, 25 January 2011

In report section you can create and use your own Jasper Reports. Reports are generated in PDF format. Starting from OpenKM 5.1 other formats can be generated.


Okm admin 061.jpeg


Add new report

Then make click New.png new report icon


Okm admin 062.jpeg


Report can use internally Scripting or SQL. The file to uploading must be .jrxml JasperReport source file. Starting with OpenKM 5.1 you can also upload compiled reports (files with .jasper extension).

SQL Report

Usually you can have a database and want to generate a report extracting data from it. In this case you should know the table relationship. Tools like Aqua Data Studio can help you to create a

Script Report

XPath Report

If you want to create a report which uses an XPath query, use scripting to do the trick. This code will query for locked documents:

import javax.jcr.*;
import javax.jcr.query.*;
import org.apache.jackrabbit.*;
import com.openkm.module.direct.*;

List al = new ArrayList ();
String statement = "/jcr:root/okm:root//element(*,okm:document)[@jcr:lockOwner]/@jcr:lockOwner";
String type = "xpath";
Session jcrSession = DirectRepositoryModule.getSystemSession();
Workspace workspace = jcrSession.getWorkspace();
QueryManager queryManager = workspace.getQueryManager();
Query query = queryManager.createQuery(statement, type);
QueryResult result = query.execute();

for (RowIterator it = result.getRows(); it.hasNext();) {
  Map ld = new HashMap();
  javax.jcr.query.Row row = it.nextRow();
  javax.jcr.Value v = row.getValue(JcrConstants.JCR_LOCKOWNER);
  ld.put("owner", v==null?"NULL":v.getString());
  v = row.getValue(JcrConstants.JCR_PATH);
  ld.put("path", v==null?"NULL":v.getString());
  al.add(ld);
}

return al;

You can finde the whole report at File:LockedDocuments.jrxml and File:SubscribedDocuments.jrxml.