Index

Objective

The objective of this guide is to describe the development, post and view of reports in Fluig. To have a better understanding, a user report example will be detailed.

 

Development Environment

For developing reports, you need to have Java™ JDK/JRE higher than 1.6. Address for download: http://java.sun.com/javase/downloads/index.jsp.

Fluig uses BIRT as a report execution engine. For this reason, in order to develop reports, you should use the BIRT standard and methodology.

It is recommended to use the BIRT Report Designer to develop reports for Fluig. BIRT can be integrated into Studio or Eclipse (already installed for use of Fluig Studio, according to the Fluig Studio Installation Guide), just install BIRT plug-in. I n order to do that, you need to access the Help-> Install New Software option and follow these procedures: 

  1. Work with: Select Indigo.
  2. Search: After listing BIRT options, enter Birt in the search field.
  3. Select the Business Intelligence, Reporting and Charting check box.
  4. Then click Next.

BIRT Report Designer has several features that assist in developing reports. Among them are: layout adjustment, data access configuration, and report formatting.

 

SaaS Environment Security

In case Fluig is executed in SaaS environment, it is not recommended the use of reports, since it is possible to create reports that return information from other companies via JPQL or Dataset query. To ensure non-execution, it is necessary to define the true value for the variable SaaS located at: %JBOSS_HOME%\jboss-as-7.2.0.Final\standalone\configuration\standalone.xml. E.g.:

<simple name="java:global/webdesk/SaaS" value="true"/>

 

Direct connection to the database

It is possible to post reports that communicate directly with the database.

Use the settings below in your report, paying attention to the values of the 'odaDriveClass' and 'odaURL' properties.

 

To make direct connection to the SQLServer database, you must use the following standard:

SQLServer
<property name="odaDriverClass">com.microsoft.sqlserver.jdbc.SQLServerDriver</property> 
<property name="odaURL">jdbc:sqlserver://IP:1433;databaseName=DATABASE</property>

 

To make direct connection to the MySQL database, you must use the following standard:

MySQL
<property name="odaDriverClass">com.mysql.jdbc.Driver</property> 
<property name="odaURL">jdbc:mysql://IP:3306/databaseName=DATABASE</property>

 

Developing a User report

Through BIRT Report Designer, you can create various reports for Fluig, access data from the product database via JPA, JDBC query. You can access other products data through JDBC connection, Web Service, or XML files.

To make it easy to understand the development of Fluig reports, we will show an example about creating reports. Following are the steps required for creating the user report with data provided from Fluig through query via dataset. The source of the mentioned example can be downloaded from the following link:

Colleague Report.zip

Creating a new project and a new report

Open the tool in which you installed BIRT Report Designer plug-in to follow the step by step. In the example we will use Fluig Studio.

  • In the previously created Fluig project, right click the reports folder, and then click New -> Fluig Report.
  • Then simply provide the Report Name and click Finish.

Figure 1 - Creation of report in Fluig project.

 

Configuring access to data

Data Source is a mechanism that keeps the connection data to the data source, for example, JDBC, Web Service settings, among others. For this report, we will use access to data via JavaScript language.

Follow these steps:


Adding parameters to the Report

You can add parameters to the report being requested for the user prior to its rendering, assisting in data query filter generating a specific report. Follow these steps:

TAGs

Fluig offers substitution TAGs to assist in the development and security of generation report information, those being:

• ${WKCompany}: substitutes the variable by the authenticated company code in Fluig.
• ${WKUser}: substitutes the variable by the authenticated user code in Fluig.

TAGs are useful in the events when information should only be generated about the company in which the user is authenticated, or in reports that show only information about the authenticated user in Fluig.

 

Populating the Data Set

In the example presented in this document, the report will be populated with data provided from JPA queries accessing Fluig database. However, you can use other resources to populateData Set: XML, Web Service and JDBC.

BIRT renders the report through the execution of its events. There are many events provided by BIRT, in this example we will use:

  • initialize: first event fired by BIRT, it is recommended to use this event to import libraries and start variables;
  • beforeOpen: event fired before BIRT opens the connection to the data source (Data Source);
  • fetch: event fired by BIRT after searching for each record in the Data Set and before applying the filters and calculated fields.

Through the events, it is possible to develop query logic and data generation via JavaScript programming language. In addition to that, it is possible to use several Java™ language resources and libraries.

 

 

Getting data via JDBC connection

An alternative way of obtaining data for creating reports is to use JDBC. You must create a Data Source that connects to the database. It will store the data for connection, via JDBC, to the database.

Attention

Birt report creation using JDBC connection requires attention related to report post security in Fluig, since the .rptdesign file (XML of the Birt report) leaves the connection to the database parameters exposed. However, the password field is dimmed with base64. For this reason and for ease of searching Fluig information, we always recommend creating reports with data sources via Fluig Dataset or JPA query.

If reports need to be created using JDBC, we recommend that, when posting a report in Fluig, the permission settings are set to read-only. Users who have maintenance permission can download the attachments and will have access to the date connection to the database.

 

Formatting Report view

You need to add the report rendering components. Click on the Layout tab to view the report page that is blank and then select the Palette tab, as shown in figure 21.

Figure 21 – Blank report.

On the Pallets tab, you can add several data view and rendering components, among which we highlight:

  • Label: Short and static text.
  • Text: Long text, it can be formated with HTML TAGS.
  • Dynamic Text: Dynamic text provided from Data Set.
  • Image: Adding images.
  • Grid: Data formatter in Grid.
  • Table: Data table.
  • Chart: Pie, line, tube graphs, and so on.

 

Rendering data from Data Set

Select the Data Explorer tab and expand the colleagueDataSet created earlier, then drag each item from the Date Set to the Detail Row column of the table previously created, as shown in figure 27. 

Figure 27 - Data Set.

 

Posting Reports

Post

Upon completing report development, you need to export it to Fluig document browsing.

 

Report Viewer

After finishing the post, to view it, click on the report in the folder where the post was made in Fluig.

A new window should open, to start execution of the user report previously developed, you need to add parameters, define their values, and then click the OK button.

Figure 32 - Report parameters.

 

The report should display all users registered in Fluig for the company in which the user is authenticated.

Figure 33 – User Report – Result.


Viewer options

Fluig report view tool has several features:

  • Check Index: If the developed report has index, you can list it.
  • Run report: Allows the report to be executed again.
  • Export data: Exports the data generated from the report in file, allowing you to select the desired columns and the data separator.
  • Export report: Converts the report data in different file formats: Microsoft® Excel®, PostScript®, PDF, Microsoft® Word, and Microsoft® Power Point® also allow to select the pages that will be exported.
  • Print report: Prints report by selecting the printers installed in the authenticated user computer and allows printing in PDF or HTML format.
  • Print report in server: Print report from the printers installed in Fluig server.
  • Page browsing: allows browsing between the pages of the report.

Figure 34 - Report viewer features.


JPA - Aggregation Functions

Aggregation Functions

Fluig supports through JPA queries and its database, the use of aggregation functions, such as: AVG, SUM, COUNT, MAX and MIN. Also allows you to use groupings: GROUP BY and HAVING

 

Entity table

The table below refers to the relationship between the dataset code, the JPA persistence entity used in queries, and the respective table in the database. The columns of the persistence entities are the same as those presented in the dataset.

Dataset code

JPA entity

Database table

AccessLog

AccessLog

HISTOR_ACES

ActivityDim

ActivityDim

ACTIVITY_DIM_CAP

advancedProcessProperties

AdvancedProcessProperties

PROPRIED_AVANCAD_PROCES

businessPeriod

BusinessPeriod

PERIOD_EXPED

destinationArea

DestinationArea

AREA_DEST

document

Document

DOCUMENT

documentSecurityConfig

DocumentSecurityConfig

CONFIGUR_SEGUR_DOCTO

FactActivityCost

FactActivityCost

FACT_ACTIVITY_COST_CAP

FactFlowVolume

FactFlowVolume

FACT_FLOW_VOLUME_CAP

FactProcesCost

FactProcesCost

FACT_PROCES_COST_CAP

FactProcesVolume

FactProcesVolume

FACT_PROCES_VOLUME_CAP

FlowDim

FlowDim

FLOW_DIM_CAP

globalCalendar

GlobalCalendar

CALEND_GLOBAL

knowledge

Knowledge

KNOWLEDGE

processAttachment

ProcessAttachment

ANEXO_PROCES

processDefinition

ProcessDefinition

DEF_PROCES

processDefinitionVersion

ProcessDefinitionVersion

VERS_DEF_PROCES

processHistory

ProcessHistory

HISTOR_PROCES

processState

ProcessState

ESTADO_PROCES

processTask

ProcessTask

TAR_PROCES

ProcesVersionDim

ProcesVersionDim

PROCES_VERSION_DIM_CAP

TimeDim

TimeDim

TIME_DIM_CAP

topic

Topic

TOPIC

UserDim

UserDim

USER_DIM_CAP

workflowProcess

WorkflowProcess

PROCES_WORKFLOW

Exemplo de Utilização

importPackage(Packages.com.datasul.technology.webdesk.dataset.service);
importPackage(Packages.java.util);

var qd = null;
var rs = null;
var rowMap = null;
var sqlJpa = "";
qd = new QueryDelegate();
sqlJpa = "SELECT count(d.documentPK.documentId), d.publisherId from Document d WHERE
d.documentPK.companyId = ${WKCompany} GROUP BY d.publisherId";
rs = qd.getResultQuery(sqlJpa);
var rowMap = rs.get(0);
//Searches for Count value
rowMap.get("d.publisherId");
//Searches for document Code
rowMap.get("count(d.documentPK.documentId)");

 

Accessing Form data

Importing libraries

From the DatasetFactory class, it is possible to access form data published in Fluig.

To populate a report through card index data, you need to import the following libraries:

importPackage(Packages.com.datasul.technology.webdesk.dataset.service);

importPackage(Packages.com.datasul.technology.webdesk.dataset);

importPackage(Packages.com.datasul.technology.webdesk.search.controller);

 

Returning form data

Through the DatasetFactory class, it is possible to search for form data and add filters and order. Use example:

//Mounts the constraints for query
var factory = DatasetFactory.getInstance(${WKCompany});
//Filters Customers 1 to 5
var c1 = factory.createConstraint("cod_cli", "1", "5",ConstraintType.MUST);
var constraints = new Array(c1);
//Orders the result by Customer name
var sortingFields = new Array("name_cli");
dataset = factory.getDataset("cad_cli", null, constraints, sortingFields);

 

The above example calls upon the getDataset method passing some additional arguments as parameters:

  • Dataset Name: Form data service name;
  • Fields: Returns only the fields received in the array provided. If null, returns all the fields.
  • Constraints: Vector with Dataset search conditions. In each search condition (constraint), you must enter the name of the form field that will be filtered, the start and end value range, and the type of Constraint. These types can be:
    • MUST: Indicates that all Dataset records must meet this condition.
    • SHOULD: Indicates that the Dataset records may or may not meet the condition. This type is more common when you need the same field to have values A or B (where each will be a SHOULD constraint).
    • MUST_NOT: indicates that none of the records can satisfy the condition.
    • Sorting: Vector with the list of fields that will be used for arragning the records in the Dataset.

The source of the above-mentioned example can be downloaded from the following link:

Customer Card Index.zip 


Search for Form data with filter by date

To query via Dataset with Date type filters, you must first save the card field in the yyyy/mm/dd format (year/month/day) so you can perform the search via Dataset.

Query example:

//Mounts the constraints for query
var factory = DatasetFactory.getInstance(${WKCompany});
//Filters Customers 1 to 5
var c1 = factory.createConstraint("campo_data", "2010/01/25", "2010/05/02", ConstraintType.MUST);
var constraints = new Array(c1);
//Orders the result by Customer name
var sortingFields = new Array("name_cli");
dataset = factory.getDataset("cad_cli", null, constraints, sortingFields);