<div id="main-content" class="wiki-content group">
<h1 id="DesenvolvimentodeRelatórios-Índice">Index</h1>
<p>
<style type='text/css'>/*<![CDATA[*/
div.rbtoc1412695710501 {
padding: 0px;
}
div.rbtoc1412695710501 ul {
list-style: none;
margin-left: 0px;
}
div.rbtoc1412695710501 li {
margin-left: 0px;
padding-left: 0px;
}
/*]]>*/
</style>
<div class='toc-macro rbtoc1412695710501'>
<ul class='toc-indentation'>
<li><span class='TOCOutline'>1</span> <a
href='#DesenvolvimentodeRelatórios-Objetivo'>Objective</a></li>
<li><span class='TOCOutline'>2</span> <a
href='#DesenvolvimentodeRelatórios-AmbientedeDesenvolvimento'>Development
Environment</a></li>
<li><span class='TOCOutline'>3</span> <a
href='#DesenvolvimentodeRelatórios-SegurançaAmbienteSaaS'>SaaS
Environment Security</a></li>
<li><span class='TOCOutline'>4</span> <a
href='#DesenvolvimentodeRelatórios-Conexãodiretacomobancodedados'>Direct
connection to the database</a></li>
<li><span class='TOCOutline'>5</span> <a
href='#DesenvolvimentodeRelatórios-DesenvolvendoumrelatóriodeUsuários'>Developing
a User report</a>
<ul class='toc-indentation'>
<li><span class='TOCOutline'>5.1</span> <a
href='#DesenvolvimentodeRelatórios-Criandoumnovoprojetoeumnovorelatório'>Creating
a new project and a new report</a></li>
<li><span class='TOCOutline'>5.2</span> <a
href='#DesenvolvimentodeRelatórios-Configurandooacessoaosdados'>Configuring
access to data</a></li>
<li><span class='TOCOutline'>5.3</span> <a
href='#DesenvolvimentodeRelatórios-IncluindoparâmetrosnoRelatório'>Adding
parameters to the Report</a></li>
<li><span class='TOCOutline'>5.4</span> <a
href='#DesenvolvimentodeRelatórios-TAG's'>TAGs</a></li>
<li><span class='TOCOutline'>5.5</span> <a
href='#DesenvolvimentodeRelatórios-PopulandooDataSet'>Populating
the Data Set</a></li>
<li><span class='TOCOutline'>5.6</span> <a
href='#DesenvolvimentodeRelatórios-ObtendodadosviaconexãoJDBC'>Getting
data via JDBC connection</a></li>
<li><span class='TOCOutline'>5.7</span> <a
href='#DesenvolvimentodeRelatórios-FormatandoavisualizaçãodoRelatório'>Formatting
Report view</a></li>
<li><span class='TOCOutline'>5.8</span> <a
href='#DesenvolvimentodeRelatórios-RenderizandodadosdoDataSet'>Rendering
data from Data Set</a></li>
</ul></li>
<li><span class='TOCOutline'>6</span> <a
href='#DesenvolvimentodeRelatórios-PublicandoRelatórios'>Posting
Reports</a>
<ul class='toc-indentation'>
<li><span class='TOCOutline'>6.1</span> <a
href='#DesenvolvimentodeRelatórios-Publicação'>Post</a></li>
</ul></li>
<li><span class='TOCOutline'>7</span> <a
href='#DesenvolvimentodeRelatórios-VisualizadordeRelatórios'>Report
Viewer</a></li>
<li><span class='TOCOutline'>8</span> <a
href='#DesenvolvimentodeRelatórios-JPA-FunçõesdeAgregação'>JPA -
Aggregation Functions</a>
<ul class='toc-indentation'>
<li><span class='TOCOutline'>8.1</span> <a
href='#DesenvolvimentodeRelatórios-FunçõesdeAgregação'>Aggregation
Functions</a></li>
<li><span class='TOCOutline'>8.2</span> <a
href='#DesenvolvimentodeRelatórios-Tabeladeentidades'>Entity
table</a></li>
<li><span class='TOCOutline'>8.3</span> <a
href='#DesenvolvimentodeRelatórios-ExemplodeUtilização'>Use
Example</a></li>
</ul></li>
<li><span class='TOCOutline'>9</span> <a
href='#DesenvolvimentodeRelatórios-AcessandodadosdeFormulários'>Accessing
Form data</a>
<ul class='toc-indentation'>
<li><span class='TOCOutline'>9.1</span> <a
href='#DesenvolvimentodeRelatórios-Importandobibliotecas'>Importing
libraries</a></li>
<li><span class='TOCOutline'>9.2</span> <a
href='#DesenvolvimentodeRelatórios-Retornandodadosdoformulário'>Returning
form data</a></li>
</ul></li>
<li><span class='TOCOutline'>10</span> <a
href='#DesenvolvimentodeRelatórios-ThirdPartyTrademarks'>Third
Party Trademarks</a></li>
</ul>
</div>
</p>
<h1 id="DesenvolvimentodeRelatórios-Objetivo">Objective</h1>
<p>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.</p>
<p> </p>
<h1 id="DesenvolvimentodeRelatórios-AmbientedeDesenvolvimento">Development
Environment</h1>
<p>
For developing reports, you need to have Java™ JDK/JRE higher than
1.6. Address for download: <a
href="http://java.sun.com/javase/downloads/index.jsp"
class="external-link" rel="nofollow">http://java.sun.com/javase/downloads/index.jsp</a>.
</p>
<p>Fluig uses BIRT as a report execution engine. For this reason,
in order to develop reports, you should use the BIRT standard and
methodology.</p>
<p>
It is recommended to use the BIRT Report Designer to develop reports
for Fluig. <span style="font-size: 10.0pt; line-height: 13.0pt;">BIRT
can be integrated into Studio or Eclipse (already installed for use
of Fluig Studio, according to the <a href="73078179.html">Fluig
Studio Installation Guide</a>), just install BIRT plug-in. I
</span><span style="font-size: 10.0pt; line-height: 13.0pt;">n order
to do that, you need to access the <em>Help-> Install New
Software</em> option and follow these procedures: 
</span>
</p>
<ol>
<li><em>Work with:</em> Select <em>Indigo</em>.</li>
<li><span style="font-size: 10.0pt; line-height: 13.0pt;"><em>Search:</em>
After listing BIRT options, enter <em>Birt</em> in the search field.</span></li>
<li>Select the <em>Business Intelligence, Reporting and
Charting</em> check box.
</li>
<li>Then click <em>Next</em>.
</li>
</ol>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/74613023.png"
data-image-src="attachments/74646056/74613023.png">
</p>
<p>BIRT Report Designer has several features that assist in
developing reports. Among them are: layout adjustment, data access
configuration, and report formatting.</p>
<p> </p>
<h1 id="DesenvolvimentodeRelatórios-SegurançaAmbienteSaaS">SaaS
Environment Security</h1>
<p>
In case Fluig is executed in SaaS environment<strong>,</strong> 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
<em>true</em> value for the variable <em>SaaS</em> located at: <em>%JBOSS_HOME%</em>\jboss-as-7.2.0.Final\standalone\configuration\standalone.xml. <span
style="font-size: 10.0pt; line-height: 13.0pt;">E.g.:</span>
</p>
<div class="code panel pdl" style="border-width: 1px;">
<div class="codeContent panelContent pdl">
<pre class="theme: Confluence; brush: xml; gutter: false"
style="font-size: 12px;"><simple name="java:global/webdesk/SaaS" value="true"/></pre>
</div>
</div>
<p> </p>
<h1 id="DesenvolvimentodeRelatórios-Conexãodiretacomobancodedados">Direct
connection to the database</h1>
<p>It is possible to post reports that communicate directly with
the database.</p>
<p>
Use the settings below in your report, paying attention to the values
of the <em>'odaDriveClass'</em> and <em>'odaURL'</em> properties.
</p>
<p> </p>
<p>
To make direct connection to the <strong>SQLServe</strong>r database,
you must use the following standard:
</p>
<div class="code panel pdl" style="border-width: 1px;">
<div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;">
<b>SQLServer</b>
</div>
<div class="codeContent panelContent pdl">
<pre class="theme: Confluence; brush: html/xml; gutter: false"
style="font-size: 12px;"><property name="odaDriverClass">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="odaURL">jdbc:sqlserver://IP:1433;databaseName=DATABASE</property></pre>
</div>
</div>
<p> </p>
<p>
To make direct connection to the <strong>MySQL</strong> database, you
must use the following standard:
</p>
<div class="code panel pdl" style="border-width: 1px;">
<div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;">
<b>MySQL</b>
</div>
<div class="codeContent panelContent pdl">
<pre class="theme: Confluence; brush: html/xml; gutter: false"
style="font-size: 12px;"><property name="odaDriverClass">com.mysql.jdbc.Driver</property>
<property name="odaURL">jdbc:mysql://IP:3306/databaseName=DATABASE</property></pre>
</div>
</div>
<p> </p>
<h1 id="DesenvolvimentodeRelatórios-DesenvolvendoumrelatóriodeUsuários">Developing
a User report</h1>
<p>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.</p>
<p>
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 <em>dataset</em>. The source of the mentioned
example can be downloaded from the following link:
</p>
<p>
<a href="attachments/74646056/74613049.zip">Colleague Report.zip</a>
</p>
<p>
<em><br /></em>
</p>
<h3
id="DesenvolvimentodeRelatórios-Criandoumnovoprojetoeumnovorelatório">Creating
a new project and a new report</h3>
<p>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.</p>
<ul>
<li>In the previously created Fluig project, right click the <em>reports</em>
folder, and then click <em>New -> Fluig Report.</em></li>
<li>Then simply provide the <em>Report Name</em> and click <em>Finish</em>.
</li>
</ul>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75236347.png"
data-image-src="attachments/74646056/75236347.png">
</p>
<p style="text-align: center;">
<strong>Figure 1 - Creation of report in Fluig project.</strong>
</p>
<p> </p>
<h3 id="DesenvolvimentodeRelatórios-Configurandooacessoaosdados">Configuring
access to data</h3>
<p>
A <em>Data Source</em> 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.
</p>
<p>Follow these steps:</p>
<a name="composition-deck-samples"></a>
<div id="samples" class="deck" history="false" loopcards="false"
effecttype="fade" effectduration="0.5" nextafter="0.0">
<ul class="tab-navigation"></ul>
<!-- // .tab-navigation -->
<div class="deck-cards panel" style="">
<div id="1" class="deck-card active-pane" style="" cssclass=""
accesskey="" label="Passo1" title="" nextafter="0"
effecttype="default" effectduration="-1.0">
<p> </p>
<ul>
<li>When creating the new report, select the <em>Report
Design</em> view and then the  <em>Data Explorer</em> tab, right
click the  <em>Data Source</em>  item and then select
the  <em>New Data Source option</em>. 
</li>
</ul>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75235575.png"
data-image-src="attachments/74646056/75235575.png">
</p>
<p style="text-align: center;">
<strong>Figure 5 - New Data Source.</strong>
</p>
<p> </p>
</div>
<div id="2" class="deck-card " style="" cssclass="" accesskey=""
label="Passo 2" title="" nextafter="0" effecttype="default"
effectduration="-1.0">
<p> </p>
<div>
<ul>
<li>When opening the <em>New Data Source</em> window, select
the <em>Scripted Data Source</em> option and define the name <em>dsColleague</em>
as the <em>Data Source Name</em>, then click <em>Finish.</em></li>
</ul>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75235576.png"
data-image-src="attachments/74646056/75235576.png">
</p>
<p style="text-align: center;">
<strong>Figure 6 - Data Source Type.</strong>
</p>
<p>
<strong><br /></strong>
</p>
</div>
</div>
<div id="3" class="deck-card " style="" cssclass="" accesskey=""
label="Passo 3" title="" nextafter="0" effecttype="default"
effectduration="-1.0">
<p> </p>
<ul>
<li><p>
In the <em>Data Explorer</em> tab, right click <em>Data Sets</em>
item, then click the <em>New Data Set</em> option, as shown in
figure 7. Data Set is a BIRT temporary table in which Data Source
data is stored and rendered in the report.
</p></li>
</ul>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75235577.png"
data-image-src="attachments/74646056/75235577.png">
</p>
<p style="text-align: center;">
<strong>Figure 7 - New Data Set.</strong>
</p>
<p style="text-align: center;">
<strong><br /></strong>
</p>
</div>
<div id="4" class="deck-card " style="" cssclass="" accesskey=""
label="Passo 4" title="" nextafter="0" effecttype="default"
effectduration="-1.0">
<p> </p>
<ul>
<li><p>
When opening the <em>New Data Set</em> window, define <em>colleagueDataSet</em>
as the <em>Data Set Name</em>, click on the <em>Next</em> button,
in <em>Output Columns</em>, click on the <em>Add</em> button and
add all the DataSet records. Next, click on the Finish button.
</p></li>
</ul>
<div>
<p> </p>
<div class="table-wrap">
<table class="confluenceTable">
<tbody>
<tr>
<td class="highlight confluenceTd"><p>
<strong>Column Name</strong>
</p></td>
<td class="highlight confluenceTd"><p>
<strong>Data Type</strong>
</p></td>
<td class="highlight confluenceTd"><p>
<strong>Column Alias</strong>
</p></td>
<td class="highlight confluenceTd"><p>
<strong>Display Name</strong>
</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>colleagueId</p></td>
<td class="confluenceTd"><p>String</p></td>
<td class="confluenceTd"><p>Blank</p></td>
<td class="confluenceTd"><p>Blank</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>Login</p></td>
<td class="confluenceTd"><p>String</p></td>
<td class="confluenceTd"><p>Blank</p></td>
<td class="confluenceTd"><p>Blank</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>colleagueName</p></td>
<td class="confluenceTd"><p>String</p></td>
<td class="confluenceTd"><p>Blank</p></td>
<td class="confluenceTd"><p>Blank</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>mail</p></td>
<td class="confluenceTd"><p>String</p></td>
<td class="confluenceTd"><p>Blank</p></td>
<td class="confluenceTd"><p>Blank</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>active</p></td>
<td class="confluenceTd"><p>String</p></td>
<td class="confluenceTd"><p>Blank</p></td>
<td class="confluenceTd"><p>Blank</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>adminuser</p></td>
<td class="confluenceTd"><p>String</p></td>
<td class="confluenceTd"><p>Blank</p></td>
<td class="confluenceTd"><p>Blank</p></td>
</tr>
</tbody>
</table>
</div>
<p> </p>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75235579.png"
data-image-src="attachments/74646056/75235579.png">
</p>
<p style="text-align: center;">
<strong>Figure 8 - Data Set Columns.</strong>
</p>
<p> </p>
</div>
</div>
</div>
</div>
<!-- // .deck -->
<p>
<em><br /></em>
</p>
<h3 id="DesenvolvimentodeRelatórios-IncluindoparâmetrosnoRelatório">Adding
parameters to the Report</h3>
<p>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:</p>
<a name="composition-deck-samples"></a>
<div id="samples" class="deck" history="false" loopcards="false"
effecttype="fade" effectduration="0.5" nextafter="0.0">
<ul class="tab-navigation"></ul>
<!-- // .tab-navigation -->
<div class="deck-cards panel" style="">
<div id="1" class="deck-card active-pane" style="" cssclass=""
accesskey="" label="Passo1" title="" nextafter="0"
effecttype="default" effectduration="-1.0">
<p> </p>
<ul>
<li>Select the  <em>Data Explorer</em> tab, then right
click the <em>Report Parameters</em> item, select the  <em>New
Parameter</em> option.
</li>
</ul>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75235586.png"
data-image-src="attachments/74646056/75235586.png">
</p>
<p style="text-align: center;">
<strong>Figure 9 - Report Parameters.</strong>
</p>
<p> </p>
</div>
<div id="2" class="deck-card " style="" cssclass="" accesskey=""
label="Passo 2" title="" nextafter="0" effecttype="default"
effectduration="-1.0">
<p> </p>
<div>
<ul>
<li><p>Figure 10 illustrates the parameter addition
window.</p></li>
</ul>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75235638.png"
data-image-src="attachments/74646056/75235638.png">
</p>
<p style="text-align: center;">
<strong>Figure 10 - Parameter configuration.</strong>
</p>
<p>
<strong><br /></strong>
</p>
<p>When you open the New Parameter window, add the following
parameters:</p>
<p> </p>
<p>
<strong>Registration</strong>
</p>
<div class="table-wrap">
<table class="confluenceTable">
<tbody>
<tr>
<th class="confluenceTh"><span
style="color: rgb(0, 51, 102);">Field</span></th>
<th class="confluenceTh"><span
style="color: rgb(0, 51, 102);">Value</span></th>
</tr>
<tr>
<td class="confluenceTd">Name</td>
<td class="confluenceTd">Registration</td>
</tr>
<tr>
<td class="confluenceTd">Prompt text</td>
<td class="confluenceTd">User Registration or "*" to
display all</td>
</tr>
<tr>
<td class="confluenceTd">Data type</td>
<td class="confluenceTd">String</td>
</tr>
<tr>
<td colspan="1" class="confluenceTd">Display type</td>
<td colspan="1" class="confluenceTd">Text Box</td>
</tr>
<tr>
<td colspan="1" class="confluenceTd">Is Required</td>
<td colspan="1" class="confluenceTd">true</td>
</tr>
</tbody>
</table>
</div>
<p> </p>
<p>
<strong>Shows Users</strong>
</p>
<div class="table-wrap">
<table class="confluenceTable">
<tbody>
<tr>
<th class="confluenceTh"><span
style="color: rgb(0, 51, 102);">Field</span></th>
<th class="confluenceTh"><span
style="color: rgb(0, 51, 102);">Value</span></th>
</tr>
<tr>
<td class="confluenceTd">Name</td>
<td class="confluenceTd">paramEnable</td>
</tr>
<tr>
<td class="confluenceTd">Prompt text</td>
<td class="confluenceTd">Display users</td>
</tr>
<tr>
<td class="confluenceTd">Data type</td>
<td class="confluenceTd">String</td>
</tr>
<tr>
<td colspan="1" class="confluenceTd">Display type</td>
<td colspan="1" class="confluenceTd">List Box</td>
</tr>
<tr>
<td colspan="1" class="confluenceTd">Is Required</td>
<td colspan="1" class="confluenceTd">true</td>
</tr>
</tbody>
</table>
</div>
<p>
<em>Selection Values</em>
</p>
<div class="table-wrap">
<table class="confluenceTable">
<tbody>
<tr>
<th class="confluenceTh"><span
style="color: rgb(0, 51, 102);">Value</span></th>
<th class="confluenceTh"><span
style="color: rgb(0, 51, 102);">Display Text</span></th>
</tr>
<tr>
<td class="confluenceTd">*</td>
<td class="confluenceTd">All</td>
</tr>
<tr>
<td class="confluenceTd">true</td>
<td class="confluenceTd">Active</td>
</tr>
<tr>
<td class="confluenceTd">false</td>
<td class="confluenceTd">Inactive</td>
</tr>
</tbody>
</table>
</div>
<p> </p>
<p>
<strong>Order by</strong>
</p>
<div class="table-wrap">
<table class="confluenceTable">
<tbody>
<tr>
<th class="confluenceTh"><span
style="color: rgb(0, 51, 102);">Field</span></th>
<th class="confluenceTh"><span
style="color: rgb(0, 51, 102);">Value</span></th>
</tr>
<tr>
<td class="confluenceTd">Name</td>
<td class="confluenceTd">paramSort</td>
</tr>
<tr>
<td class="confluenceTd">Prompt text</td>
<td class="confluenceTd">Order by</td>
</tr>
<tr>
<td class="confluenceTd">Data type</td>
<td class="confluenceTd">String</td>
</tr>
<tr>
<td colspan="1" class="confluenceTd">Display type</td>
<td colspan="1" class="confluenceTd">List Box</td>
</tr>
</tbody>
</table>
</div>
<p>
<em>Selection Values</em>
</p>
<div class="table-wrap">
<table class="confluenceTable">
<tbody>
<tr>
<th class="confluenceTh"><span
style="color: rgb(0, 51, 102);">Value</span></th>
<th class="confluenceTh"><span
style="color: rgb(0, 51, 102);">Display Text</span></th>
</tr>
<tr>
<td class="confluenceTd">c.colleaguePK.colleagueId</td>
<td class="confluenceTd">Registration</td>
</tr>
<tr>
<td class="confluenceTd">c.colleagueName</td>
<td class="confluenceTd">Name</td>
</tr>
<tr>
<td class="confluenceTd">c.login</td>
<td class="confluenceTd">Login</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- // .deck -->
<p> </p>
<h3 id="DesenvolvimentodeRelatórios-TAG's">TAGs</h3>
<p>Fluig offers substitution TAGs to assist in the development and
security of generation report information, those being:</p>
<p>
• ${WKCompany}: substitutes the variable by the authenticated company
code in Fluig.<br />• ${WKUser}: substitutes the variable by the
authenticated user code in Fluig.
</p>
<p>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.</p>
<p> </p>
<h3 id="DesenvolvimentodeRelatórios-PopulandooDataSet">Populating
the Data Set</h3>
<p>
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 populate <em>Data
Set</em>: XML, Web Service and JDBC.
</p>
<p>BIRT renders the report through the execution of its events.
There are many events provided by BIRT, in this example we will use:</p>
<ul>
<li><em>initialize: </em> first event fired by BIRT, it is
recommended to use this event to import libraries and start
variables;</li>
<li><em>beforeOpen</em>: event fired before BIRT opens the
connection to the data source (<em>Data Source</em>);</li>
<li><em>fetch</em>: event fired by BIRT after searching for each
record in the Data Set and before applying the filters and calculated
fields.</li>
</ul>
<p>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.</p>
<p> </p>
<a name="composition-deck-samples"></a>
<div id="samples" class="deck" history="false" loopcards="false"
effecttype="fade" effectduration="0.5" nextafter="0.0">
<ul class="tab-navigation"></ul>
<!-- // .tab-navigation -->
<div class="deck-cards panel" style="">
<div id="1" class="deck-card active-pane" style="" cssclass=""
accesskey="" label="Initialize" title="" nextafter="0"
effecttype="default" effectduration="-1.0">
<p> </p>
<ul>
<li>Select the  <em>Script</em>  tab in the report
page, and then select the  <em>initialize</em> event, add the
following code as shown in figure 11:
</li>
</ul>
<div class="code panel pdl" style="border-width: 1px;">
<div class="codeContent panelContent pdl">
<pre class="theme: Confluence; brush: javascript; gutter: false"
style="font-size: 12px;">importPackage(Packages.com.datasul.technology.webdesk.dataset.service);
importPackage(Packages.com.datasul.technology.webdesk.dataset);
importPackage(Packages.com.datasul.technology.webdesk.search.controller);
importPackage(Packages.java.util);
var count = 0;
var dataset = null;
</pre>
</div>
</div>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75235738.png"
data-image-src="attachments/74646056/75235738.png">
</p>
<p style="text-align: center;">
<strong>Figure 11 - initialize Event.</strong>
</p>
<p> </p>
<p>The above code imports the Java™ libraries and the library
provided by Fluig to query the product data, in addition to
starting the variables used by the report.</p>
<p>Details about the code:</p>
<ul>
<li style="list-style-type: none;"><ul>
<li><em>importPackage</em>: command responsible for
importing Java™ libraries.</li>
<li><em>Package.java.util</em>: library responsible for
Java™ <em>utils</em> Classes.</li>
<li><em>Packages.com.datasul.technology.webdesk.dataset.service</em><span>:
library provided by Fluig to query the product database.</span><span><br /></span><br />
<span><br /></span></li>
</ul></li>
</ul>
</div>
<div id="2" class="deck-card " style="" cssclass="" accesskey=""
label="BeforeOpen" title="" nextafter="0" effecttype="default"
effectduration="-1.0">
<p> </p>
<ul>
<li>Select the <em>Data Explorer</em> tab, expand the <em>Data
Sets</em> item and click on <em>colleagueDataSet, then click the
Script tab</em>, select the <em>beforeOpen</em> event and add the
following code as shown in figure 12.
</li>
</ul>
<div class="code panel pdl" style="border-width: 1px;">
<div class="codeContent panelContent pdl">
<pre class="theme: Confluence; brush: javascript; gutter: false"
style="font-size: 12px;">try{
var factory = DatasetFactory.getInstance(${WKCompany});
var constraints = new Array();
var sortingFields = new Array();
var i = 0;
//Filters only by registration of the user provided
if(params["Registration"].value != null &amp;&amp; params["Registration"].value != "*") {
constraints[i] = factory.createConstraint("colleaguePK.colleagueId", params["Registration"].value, params["Registration"].value, ConstraintType.MUST);
i++;
}
//Filters active if selected
if(params["paramEnable"].value != null &amp;&amp; params["paramEnable"].value != "*"){
constraints[i] = factory.createConstraint("active", params["paramEnable"].value, params["paramEnable"].value, ConstraintType.MUST);
i++;
}
//Orders according to selection
if(params["paramSort"].value != null &amp;&amp; params["paramSort"].value != "*"){
sortingFields[0] = params["paramSort"].value;
}
//Dataset
dataset = factory.getDataset("colleague", null, constraints, sortingFields);
}catch (e) {
}finally {
}
</pre>
</div>
</div>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75235749.png"
data-image-src="attachments/74646056/75235749.png">
</p>
<p style="text-align: center;">
<strong>Figure 12 - BeforeOpen Event.</strong>
</p>
<p>
<strong><br /></strong>
</p>
<p>The above code mounts the report query by querying via
dataset and adds the request filters according to the parameters
defined by the user.</p>
<p>Details about the code:</p>
<ul>
<li>${WKCompany}: TAG provided by Fluig, returns the company
code in which the user is authenticated;</li>
<li>params["Registration"]: report parameter, returns the
registration code defined by the user;</li>
<li>params["paramEnable "]: report parameter, returns user
type;</li>
<li><span style="font-size: 10.0pt; line-height: 13.0pt;">params["paramSort
"]: report parameter, returns the ordering mode;</span><br />
<span style="font-size: 10.0pt; line-height: 13.0pt;"><br /></span></li>
</ul>
</div>
<div id="3" class="deck-card " style="" cssclass="" accesskey=""
label="Fetch" title="" nextafter="0" effecttype="default"
effectduration="-1.0">
<ul>
<li>To include the result of the query in the <em>Data
Set</em> and format the report data, select the <em>fetch</em> event
in the <em>Script</em> area and add the following code<em> </em>as
shown in figure 13.
</li>
</ul>
<div class="code panel pdl" style="border-width: 1px;">
<div class="codeContent panelContent pdl">
<pre class="theme: Confluence; brush: javascript; gutter: false"
style="font-size: 12px;">if (dataset != null) {
if (count < dataset.rowsCount){
//mounts the line object
row["colleagueId"] = dataset.getValue(count, "colleaguePK.colleagueId");
row["login"] = dataset.getValue(count, "login");
row["colleagueName"] = dataset.getValue(count, "colleagueName");
row["mail"] = dataset.getValue(count, "mail");
if(dataset.getValue(count, "active") == true){
row["active"] = "Sim";
}else{
row["active"] = "Não";
}
//Updates the counter
count++;
return true;
}
return false;
}</pre>
</div>
</div>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75235761.png"
data-image-src="attachments/74646056/75235761.png">
</p>
<p style="text-align: center;">
<strong>Figure 13 - fetch Event<em>.</em></strong>
</p>
<p style="text-align: center;">
<strong><em><br /></em></strong>
</p>
</div>
</div>
</div>
<!-- // .deck -->
<p> </p>
<h3 id="DesenvolvimentodeRelatórios-ObtendodadosviaconexãoJDBC">Getting
data via JDBC connection</h3>
<p>
An alternative way of obtaining data for creating reports is to use
JDBC. You must create a <em>Data</em> <em>Source</em> that connects to
the database. It will store the data for connection, via JDBC, to the
database.
</p>
<a name="composition-deck-samples"></a>
<div id="samples" class="deck" history="false" loopcards="false"
effecttype="fade" effectduration="0.5" nextafter="0.0">
<ul class="tab-navigation"></ul>
<!-- // .tab-navigation -->
<div class="deck-cards panel" style="">
<div id="1" class="deck-card active-pane" style="" cssclass=""
accesskey="" label="Passo 1" title="" nextafter="0"
effecttype="default" effectduration="-1.0">
<p> </p>
<ul>
<li><p>
Select the <em>Data Explorer</em> tab, right click the <em>Data
Source</em> item, then select the <em>New Data Set</em> option, as
shown in figure 14.
</p>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75236461.png"
data-image-src="attachments/74646056/75236461.png">
</p>
<p style="text-align: center;">
<strong>Figure 14 - New Data Source</strong>
</p>
<p style="text-align: center;">
<strong><br /></strong>
</p></li>
</ul>
</div>
<div id="2" class="deck-card " style="" cssclass="" accesskey=""
label="Passo 2" title="" nextafter="0" effecttype="default"
effectduration="-1.0">
<p> </p>
<ul>
<li><p>
When you open the <em>New Data Source</em> window, select the <em>JDBC
DataSource</em> option and define the name <em>JDBC-DataSource</em>
as the <em>Data Source Name</em>, then click the <em>Next</em>
button, according to figure 15.
</p>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75236462.png"
data-image-src="attachments/74646056/75236462.png">
</p>
<p style="text-align: center;">
<strong>Figure 15 - Data Source Type</strong>
</p>
<p style="text-align: center;">
<strong><br /></strong>
</p></li>
</ul>
</div>
<div id="3" class="deck-card " style="" cssclass="" accesskey=""
label="Passo 3" title="" nextafter="0" effecttype="default"
effectduration="-1.0">
<p> </p>
<ul>
<li><p>In the next window, the connection to the database
must be configured. </p>
<p>
In the  <em>Driver</em> <em>Class</em>  field,
select the connection driver to the database, in this case, the
connection will be made with the MySQL® database. If the required
driver is not listed, simply add it by clicking  <em>Managed</em> 
<em>Drivers</em>...
</p>
<p>
Also provide the values for  <em>Database URL, User
Name </em> and  <em>Password </em> according to the
chosen database, as shown in figure 16.
</p>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75236463.png"
data-image-src="attachments/74646056/75236463.png">
</p>
<p style="text-align: center;">
<strong>Figure 16 – Configuring database connection.</strong>
</p>
<p style="text-align: center;">
<strong><br /></strong>
</p></li>
</ul>
</div>
<div id="4" class="deck-card " style="" cssclass="" accesskey=""
label="Passo 4" title="" nextafter="0" effecttype="default"
effectduration="-1.0">
<p> </p>
<ul>
<li><p>
In the  <em>Data Explorer</em>  tab, right click the
 <em>Data Sets</em>  item, then click the  <em>New
Data Set</em>  option.
</p>
<p style="text-align: center;">
<img class="confluence-embedded-image"
src="attachments/74646056/75236479.png"
data-image-src="attachments/74646056/75236479.png">
</p>
<p style="text-align: center;">
<strong>Figure 17 – Creating New Data Set.</strong>
</p>
<p style="text-align: center;">
<strong><br /></strong>
</p></li>
</ul>
</div>
<div id="5" class="deck-card " style="" cssclass="" accesskey=""
label="Passo 5" title="" nextafter="0" effecttype="default"
effectduration="-1.0">
<p> </p>
<ul>
<li>Select the  <em>Data</em><em>Source</em> 
created (<em>JDBC-DataSource</em>), in the  <em>Date Set
Type</em>  field, select SQL  <em>Select Query</em>, enter a
name for the  <em>Data Set </em> and click  <em>next,
as shown in figure 18.</em></li>
</ul>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75236465.png"
data-image-src="attachments/74646056/75236465.png">
</p>
<p style="text-align: center;">
<strong>Figure 18 - Configuring Data Set.</strong>
</p>
<p style="text-align: center;">
<strong><br /></strong>
</p>
</div>
<div id="6" class="deck-card " style="" cssclass="" accesskey=""
label="Passo 6" title="" nextafter="0" effecttype="default"
effectduration="-1.0">
<p> </p>
<ul>
<li> On the next screen, enter the SQL that searches data
in the database, in this example, the Fluig authenticated company
volumes will be searched.</li>
</ul>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75236490.png"
data-image-src="attachments/74646056/75236490.png">
</p>
<p style="text-align: center;">
<strong>Figure 19 – Creation of SQL Query</strong>
</p>
<p style="text-align: center;">
<strong><br /></strong>
</p>
<ul>
<li><p>
The <em>Query </em> below searches the database for all the user
company volumes authenticated in Fluig. This code is obtained by
TAG ${WKCompany}.
</p></li>
</ul>
<div class="code panel pdl" style="border-width: 1px;">
<div class="codeContent panelContent pdl">
<pre class="theme: Confluence; brush: java; gutter: false"
style="font-size: 12px;">SELECT vol_fisic.CD_VOL_FISIC,
vol_fisic.COD_COMPANY,
vol_fisic.NOM_DIR_FISIC,
vol_fisic.ID_TIP_VOL_FISIC
FROM vol_fisic
WHERE vol_fisic.COD_COMPANY = ${WKCompany}</pre>
</div>
</div>
<div class="aui-message hint shadowed information-macro">
<p class="title">Note</p>
<span class="aui-icon icon-hint">Icon</span>
<div class="message-content">
<p>
An error may occur when finishing the creation of the <em>Data</em>
<em>Set</em>, since TAG ${WKCompany} does not exist in the BIRT
context. The following figure shows the error that resulted from
the use of the TAG, this is a syntax error in SQL and indicates
that ${WKCompany} is not an SQL command. However when the report
is executed in Fluig, it returns the company code as it should
and, as a result, the TAG will be replaced by the company code of
the user authenticated in Fluig, correcting the syntax error.
</p>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75236495.png"
data-image-src="attachments/74646056/75236495.png">
</p>
<p style="text-align: center;">
<strong>Figure 20 – Birt error for using TAG
${WKCompany}</strong>
</p>
</div>
</div>
<p style="text-align: center;">
<strong><br /></strong>
</p>
</div>
</div>
</div>
<!-- // .deck -->
<div class="aui-message warning shadowed information-macro">
<p class="title">Attention</p>
<span class="aui-icon icon-warning">Icon</span>
<div class="message-content">
<p>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.</p>
<p>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.</p>
</div>
</div>
<p> </p>
<h3 id="DesenvolvimentodeRelatórios-FormatandoavisualizaçãodoRelatório">Formatting
Report view</h3>
<p>
You need to add the report rendering components. Click on the <em>Layout</em>
tab to view the report page that is blank and then select the <em>Palette</em>
tab, as shown in figure 21.
</p>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75235783.png"
data-image-src="attachments/74646056/75235783.png">
</p>
<p style="text-align: center;">
<strong>Figure 21 – Blank report.</strong>
</p>
<p>On the Pallets tab, you can add several data view and rendering
components, among which we highlight:</p>
<ul>
<li>Label: Short and static text.</li>
<li>Text: Long text, it can be formated with HTML TAGS.</li>
<li>Dynamic Text: Dynamic text provided from Data Set.</li>
<li>Image: Adding images.</li>
<li>Grid: Data formatter in Grid.</li>
<li>Table: Data table.</li>
<li>Chart: Pie, line, tube graphs, and so on.</li>
</ul>
<a name="composition-deck-samples"></a>
<div id="samples" class="deck" history="false" loopcards="false"
effecttype="fade" effectduration="0.5" nextafter="0.0">
<ul class="tab-navigation"></ul>
<!-- // .tab-navigation -->
<div class="deck-cards panel" style="">
<div id="1" class="deck-card active-pane" style="" cssclass=""
accesskey="" label="Componente Image" title="" nextafter="0"
effecttype="default" effectduration="-1.0">
<p> </p>
<ul>
<li><p>You can add images from the Internet, add file
images, or even embed the image in the XML report. In this
example, we will use an attached image to show later how to
publish reports with attachment.</p>
<p>
Drag an <em>Image</em> component to the report, when
opening the window <em>Edit Image </em> Item, select
the  option <em>Image file in shared resources</em>, select
the image file in the <em>Enter resource file option and</em>
then click the <em>Insert</em> button.
</p>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75235792.png"
data-image-src="attachments/74646056/75235792.png">
</p>
<p style="text-align: center;">
<strong>Figure 22 - Image Component.</strong>
</p>
<p style="text-align: center;">
<strong><br /></strong>
</p></li>
</ul>
</div>
<div id="2" class="deck-card " style="" cssclass="" accesskey=""
label="Componente Text" title="" nextafter="0" effecttype="default"
effectduration="-1.0">
<p> </p>
<ul>
<li><p>
Drag a <em>Text</em> component to the report, when opening the <em>Edit
Text Item</em> window, select the <em>HTML</em> option and, in the
text area, add the following information formatted in HTML:
</p></li>
</ul>
<div class="code panel pdl" style="border-width: 1px;">
<div class="codeContent panelContent pdl">
<pre class="theme: Confluence; brush: html/xml; gutter: false"
style="font-size: 12px;"><br>
<a href="http://www.fluig.com/">http://www.fluig.com/</a>
<br><b>E-mail:</b> <a href="mailto:[email protected]">[email protected]</a>
<br><b>Telefone:</b> 0800 882 9191
<br></pre>
</div>
</div>
<div>
<ul>
<li><p>
Then click the <em>OK</em> button as shown in figure 23.
</p></li>
</ul>
</div>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75235799.png"
data-image-src="attachments/74646056/75235799.png">
</p>
<p style="text-align: center;">
<strong>Figure 23 - Text Component.</strong>
</p>
<p style="text-align: center;">
<strong><br /></strong>
</p>
</div>
<div id="3" class="deck-card " style="" cssclass="" accesskey=""
label="Componente Label" title="" nextafter="0" effecttype="default"
effectduration="-1.0">
<p> </p>
<ul>
<li>Drag a <em>Label</em> component to the report,
double-click the component included and type <em>User Report</em>,
in the <em>Property Editor - Label -> G</em><em>eneral</em> tab,
define the label format, as shown in figure 24.
</li>
</ul>
<p>
 <img class="confluence-embedded-image image-center"
src="attachments/74646056/75235800.png"
data-image-src="attachments/74646056/75235800.png">
</p>
<p style="text-align: center;">
<strong>Figure 24 - Report title.</strong>
</p>
<p style="text-align: center;">
<strong><br /></strong>
</p>
</div>
<div id="4" class="deck-card " style="" cssclass="" accesskey=""
label="Componente Table" title="" nextafter="0" effecttype="default"
effectduration="-1.0">
<p> </p>
<ul>
<li>Drag a <em>Table</em> component, when opening the <em>Insert
Table</em> window, define 6 columns and 1 detail, and click the <em>OK</em>
button, as shown in figure 25.
</li>
</ul>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75235806.png"
data-image-src="attachments/74646056/75235806.png">
</p>
<p style="text-align: center;">
<strong>Figure 25 - Table Configuration</strong>
</p>
<p style="text-align: left;">
<strong><br /></strong>
</p>
</div>
<div id="5" class="deck-card " style="" cssclass="" accesskey=""
label="Lables para Table" title="" nextafter="0"
effecttype="default" effectduration="-1.0">
<p> </p>
<p>
In the table added to the report, add a <em>Label</em> component
for each column of the <em>Header Row</em> line, define the
following values<em>:</em>
</p>
<ul>
<li><span style="font-size: 10.0pt; line-height: 13.0pt;">Registration.</span></li>
<li>Name.</li>
<li>Login.</li>
<li>Email.</li>
<li>Active.</li>
<li>Administrator.</li>
</ul>
<p>
Format the <em>labels</em> included by defining font color and
background color, as shown in figure 26.
</p>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75235812.png"
data-image-src="attachments/74646056/75235812.png">
</p>
<p style="text-align: center;">
<strong>Figure 26 - Column Titles.</strong>
</p>
<p style="text-align: center;">
<strong><br /></strong>
</p>
</div>
</div>
</div>
<!-- // .deck -->
<p> </p>
<h3 id="DesenvolvimentodeRelatórios-RenderizandodadosdoDataSet">Rendering
data from Data Set</h3>
<p>
Select the <em>Data Explorer</em> tab and expand the <em>colleagueDataSet</em>
created earlier, then drag each item from the <em>Date Set</em> to the
<em>Detail Row</em> column of the table previously created, as shown
in figure 27. 
</p>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75235816.png"
data-image-src="attachments/74646056/75235816.png">
</p>
<p style="text-align: center;">
<strong>Figure 27 - Data Set.</strong>
</p>
<p style="text-align: left;"> </p>
<h1 style="text-align: left;"
id="DesenvolvimentodeRelatórios-PublicandoRelatórios">Posting
Reports</h1>
<h3 style="text-align: left;"
id="DesenvolvimentodeRelatórios-Publicação">Post</h3>
<p>Upon completing report development, you need to export it to
Fluig document browsing.</p>
<a name="composition-deck-samples"></a>
<div id="samples" class="deck" history="false" loopcards="false"
effecttype="fade" effectduration="0.5" nextafter="0.0">
<ul class="tab-navigation"></ul>
<!-- // .tab-navigation -->
<div class="deck-cards panel" style="">
<div id="1" class="deck-card active-pane" style="" cssclass=""
accesskey="" label="Passo1" title="" nextafter="0"
effecttype="default" effectduration="-1.0">
<p> </p>
<p>
To do this, right click the report folder and click  <em>Export</em>.
</p>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75236393.png"
data-image-src="attachments/74646056/75236393.png">
</p>
<p style="text-align: center;">
<strong>Figure 28 – Report Export.</strong>
</p>
<p style="text-align: left;">
<strong><br /></strong>
</p>
<div class="aui-message hint shadowed information-macro">
<p class="title">Note</p>
<span class="aui-icon icon-hint">Icon</span>
<div class="message-content">
<p>Attachments are exported along with the report. During
export, the .rptdesign file is automatically identified as the
main file, and the other files are classified as attachment.</p>
</div>
</div>
</div>
<div id="2" class="deck-card " style="" cssclass="" accesskey=""
label="Passo 2" title="" nextafter="0" effecttype="default"
effectduration="-1.0">
<p> </p>
<div>
<ul>
<li><p>
<span>In the Export screen, click  <em>Export
to Fluig server</em>  and then click  <em>Next</em>.
</span>
</p>
<p> </p>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75236394.png"
data-image-src="attachments/74646056/75236394.png">
</p>
<p style="text-align: center;">
<strong>Figure 29 – Report export.</strong>
</p>
<p style="text-align: center;">
<strong><br /></strong>
</p></li>
</ul>
</div>
</div>
<div id="3" class="deck-card " style="" cssclass="" accesskey=""
label="Passo 3" title="" nextafter="0" effecttype="default"
effectduration="-1.0">
<p> </p>
<ul>
<li><p>
In the  <em>Export Report</em> screen, it is necessary to
provide the  <em>Server</em> name, identify if this will be
the posting of a  <em>New Report</em>, define the name of
the report, the Target Folder (as per image, the target folder
code was provided) and then tag the  <em>Versioning</em> 
type (since we are creating a new post, we selected  <em>Keep
Current</em>).
</p>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75236396.png"
data-image-src="attachments/74646056/75236396.png">
</p>
<p style="text-align: center;">
<strong>Figure 29 – Report export.</strong>
</p>
<p style="text-align: center;">
<strong><br /></strong>
</p></li>
</ul>
</div>
<div id="4" class="deck-card " style="" cssclass="" accesskey=""
label="Passo 4" title="" nextafter="0" effecttype="default"
effectduration="-1.0">
<p> </p>
<ul>
<li>In the <em>Report </em> folder of  <em>Document
Browsing</em>, you will be able to see that the report has been
published successfully.
</li>
</ul>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75236397.png"
data-image-src="attachments/74646056/75236397.png">
</p>
<p style="text-align: center;">
<strong>Figure 29 – Report posting.</strong>
</p>
<p style="text-align: center;">
<strong><br /></strong>
</p>
</div>
</div>
</div>
<!-- // .deck -->
<p> </p>
<h1 style="text-align: left;"
id="DesenvolvimentodeRelatórios-VisualizadordeRelatórios">Report
Viewer</h1>
<p>After finishing the post, to view it, click on the report in the
folder where the post was made in Fluig.</p>
<p>
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 <em>OK</em> button.
</p>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75236428.png"
data-image-src="attachments/74646056/75236428.png">
</p>
<p style="text-align: center;">
<strong>Figure 32 - Report parameters.</strong>
</p>
<p> </p>
<p>The report should display all users registered in Fluig for the
company in which the user is authenticated.</p>
<p>
<img class="confluence-embedded-image image-center"
src="attachments/74646056/75236430.png"
data-image-src="attachments/74646056/75236430.png">
</p>
<p style="text-align: center;">
<strong>Figure 33 – User Report – Result</strong>.
</p>
<p style="text-align: left;">
<strong><br /></strong>
</p>
<p style="text-align: left;">
<span
style="color: rgb(0, 0, 0); font-size: 1.4em; font-weight: bold; line-height: normal;">Viewer
options</span>
</p>
<p>Fluig report view tool has several features:</p>
<ul>
<li><em>Check Index</em>: If the developed report has index, you
can list it.</li>
<li><em>Run report</em>: Allows the report to be executed again.</li>
<li><em>Export data: </em>Exports the data generated from the
report in file, allowing you to select the desired columns and the
data separator.</li>
<li><em>Export report</em>: 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.</li>
<li><em>Print report</em>: Prints report by selecting the
printers installed in the authenticated user computer and allows
printing in PDF or HTML format.</li>
<li><em>Print report in server: </em>Print report from the
printers installed in Fluig server.</li>
<li>Page browsing: allows browsing between the pages of the
report.</li>
</ul>
<p>
<img class="confluence-embedded-image"
src="attachments/74646056/75236439.png"
data-image-src="attachments/74646056/75236439.png">
</p>
<p style="text-align: center;">
<strong>Figure 34 - Report viewer features.</strong>
</p>
<p style="text-align: left;">
<strong><br /></strong>
</p>
<div>
<h1 id="DesenvolvimentodeRelatórios-JPA-FunçõesdeAgregação">JPA -
Aggregation Functions</h1>
</div>
<h3 id="DesenvolvimentodeRelatórios-FunçõesdeAgregação">Aggregation
Functions</h3>
<p>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</p>
<p> </p>
<h3 id="DesenvolvimentodeRelatórios-Tabeladeentidades">Entity
table</h3>
<p>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.</p>
<div class="table-wrap">
<table class="confluenceTable">
<tbody>
<tr>
<td class="highlight confluenceTd"><p>
<strong>Dataset code</strong>
</p></td>
<td class="highlight confluenceTd"><p>
<strong>JPA entity</strong>
</p></td>
<td class="highlight confluenceTd"><p>
<strong>Database table</strong>
</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>AccessLog</strong>
</p></td>
<td class="confluenceTd"><p>AccessLog</p></td>
<td class="confluenceTd"><p>HISTOR_ACES</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>ActivityDim</strong>
</p></td>
<td class="confluenceTd"><p>ActivityDim</p></td>
<td class="confluenceTd"><p>ACTIVITY_DIM_CAP</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>advancedProcessProperties</strong>
</p></td>
<td class="confluenceTd"><p>AdvancedProcessProperties</p></td>
<td class="confluenceTd"><p>PROPRIED_AVANCAD_PROCES</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>businessPeriod</strong>
</p></td>
<td class="confluenceTd"><p>BusinessPeriod</p></td>
<td class="confluenceTd"><p>PERIOD_EXPED</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>destinationArea</strong>
</p></td>
<td class="confluenceTd"><p>DestinationArea</p></td>
<td class="confluenceTd"><p>AREA_DEST</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>document</strong>
</p></td>
<td class="confluenceTd"><p>Document</p></td>
<td class="confluenceTd"><p>DOCUMENT</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>documentSecurityConfig</strong>
</p></td>
<td class="confluenceTd"><p>DocumentSecurityConfig</p></td>
<td class="confluenceTd"><p>CONFIGUR_SEGUR_DOCTO</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>FactActivityCost</strong>
</p></td>
<td class="confluenceTd"><p>FactActivityCost</p></td>
<td class="confluenceTd"><p>FACT_ACTIVITY_COST_CAP</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>FactFlowVolume</strong>
</p></td>
<td class="confluenceTd"><p>FactFlowVolume</p></td>
<td class="confluenceTd"><p>FACT_FLOW_VOLUME_CAP</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>FactProcesCost</strong>
</p></td>
<td class="confluenceTd"><p>FactProcesCost</p></td>
<td class="confluenceTd"><p>FACT_PROCES_COST_CAP</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>FactProcesVolume</strong>
</p></td>
<td class="confluenceTd"><p>FactProcesVolume</p></td>
<td class="confluenceTd"><p>FACT_PROCES_VOLUME_CAP</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>FlowDim</strong>
</p></td>
<td class="confluenceTd"><p>FlowDim</p></td>
<td class="confluenceTd"><p>FLOW_DIM_CAP</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>globalCalendar</strong>
</p></td>
<td class="confluenceTd"><p>GlobalCalendar</p></td>
<td class="confluenceTd"><p>CALEND_GLOBAL</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>knowledge</strong>
</p></td>
<td class="confluenceTd"><p>Knowledge</p></td>
<td class="confluenceTd"><p>KNOWLEDGE</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>processAttachment</strong>
</p></td>
<td class="confluenceTd"><p>ProcessAttachment</p></td>
<td class="confluenceTd"><p>ANEXO_PROCES</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>processDefinition</strong>
</p></td>
<td class="confluenceTd"><p>ProcessDefinition</p></td>
<td class="confluenceTd"><p>DEF_PROCES</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>processDefinitionVersion</strong>
</p></td>
<td class="confluenceTd"><p>ProcessDefinitionVersion</p></td>
<td class="confluenceTd"><p>VERS_DEF_PROCES</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>processHistory</strong>
</p></td>
<td class="confluenceTd"><p>ProcessHistory</p></td>
<td class="confluenceTd"><p>HISTOR_PROCES</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>processState</strong>
</p></td>
<td class="confluenceTd"><p>ProcessState</p></td>
<td class="confluenceTd"><p>ESTADO_PROCES</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>processTask</strong>
</p></td>
<td class="confluenceTd"><p>ProcessTask</p></td>
<td class="confluenceTd"><p>TAR_PROCES</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>ProcesVersionDim</strong>
</p></td>
<td class="confluenceTd"><p>ProcesVersionDim</p></td>
<td class="confluenceTd"><p>PROCES_VERSION_DIM_CAP</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>TimeDim</strong>
</p></td>
<td class="confluenceTd"><p>TimeDim</p></td>
<td class="confluenceTd"><p>TIME_DIM_CAP</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>topic</strong>
</p></td>
<td class="confluenceTd"><p>Topic</p></td>
<td class="confluenceTd"><p>TOPIC</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>UserDim</strong>
</p></td>
<td class="confluenceTd"><p>UserDim</p></td>
<td class="confluenceTd"><p>USER_DIM_CAP</p></td>
</tr>
<tr>
<td class="confluenceTd"><p>
<strong>workflowProcess</strong>
</p></td>
<td class="confluenceTd"><p>WorkflowProcess</p></td>
<td class="confluenceTd"><p>PROCES_WORKFLOW</p></td>
</tr>
</tbody>
</table>
</div>
<p> </p>
<h3 id="DesenvolvimentodeRelatórios-ExemplodeUtilização">Use
Example</h3>
<div class="code panel pdl" style="border-width: 1px;">
<div class="codeContent panelContent pdl">
<pre class="theme: Confluence; brush: java; gutter: false"
style="font-size: 12px;">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)");</pre>
</div>
</div>
<p> </p>
<div>
<h1 id="DesenvolvimentodeRelatórios-AcessandodadosdeFormulários">Accessing
Form data</h1>
</div>
<h3 id="DesenvolvimentodeRelatórios-Importandobibliotecas">Importing
libraries</h3>
<p>From the DatasetFactory class, it is possible to access form
data published in Fluig.</p>
<p>To populate a report through card index data, you need to import
the following libraries:</p>
<div class="code panel pdl" style="border-width: 1px;">
<div class="codeContent panelContent pdl">
<pre class="theme: Confluence; brush: java; gutter: false"
style="font-size: 12px;">importPackage(Packages.com.datasul.technology.webdesk.dataset.service);
importPackage(Packages.com.datasul.technology.webdesk.dataset);
importPackage(Packages.com.datasul.technology.webdesk.search.controller);</pre>
</div>
</div>
<p style="text-align: left;"> </p>
<h3 style="text-align: left;"
id="DesenvolvimentodeRelatórios-Retornandodadosdoformulário">Returning
form data</h3>
<p>Through the DatasetFactory class, it is possible to search for
form data and add filters and order. Use example:</p>
<div class="code panel pdl" style="border-width: 1px;">
<div class="codeContent panelContent pdl">
<pre class="theme: Confluence; brush: java; gutter: false"
style="font-size: 12px;">//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);</pre>
</div>
</div>
<p> </p>
<p>The above example calls upon the getDataset method passing some
additional arguments as parameters:</p>
<ul>
<li><strong>Dataset Name:</strong> Form data service name;</li>
<li><strong>Fields:</strong> Returns only the fields received in
the array provided. If null, returns all the fields.</li>
<li><strong>Constraints:</strong> 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:</li>
</ul>
<ul>
<li style="list-style-type: none;"><ul>
<li><strong>MUST:</strong> Indicates that all Dataset records
must meet this condition.</li>
<li><strong>SHOULD:</strong> 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).</li>
<li><strong>MUST_NOT:</strong> indicates that none of the
records can satisfy the condition.</li>
<li><strong>Sorting:</strong> Vector with the list of fields
that will be used for arragning the records in the Dataset.</li>
</ul></li>
</ul>
<p>
<span>The source of the above-mentioned example can be
downloaded from the following link:</span>
</p>
<p>
<span><a href="attachments/74646056/75236518.zip">Customer
CardIndex.zip</a></span>
</p>
<p>
<span
style="color: rgb(0, 0, 0); font-size: 1.4em; font-weight: bold; line-height: normal;"><br /></span>
</p>
<p>
<span
style="color: rgb(0, 0, 0); font-size: 1.4em; font-weight: bold; line-height: normal;">Search
for Form data with filter by date</span>
</p>
<p>
To query via Dataset with Date type filters, you must first save the
card field in the <strong>yyyy/mm/dd</strong> format (year/month/day)
so you can perform the search via Dataset.
</p>
<p>Query example:</p>
<div class="code panel pdl" style="border-width: 1px;">
<div class="codeContent panelContent pdl">
<pre class="theme: Confluence; brush: java; gutter: false"
style="font-size: 12px;">//Mounts the constraints for query
var factory = DatasetFactory.getInstance(${WKCompany});
//Filters Customers 1 to 5
var c1 = factory.createConstraint("campo_data", "2010/01/25cod_cli", "2010/05/021", "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);</pre>
</div>
</div>
<p>
<em><br /></em>
</p>
<div>
<h1 id="DesenvolvimentodeRelatórios-ThirdPartyTrademarks">Third-Party
Trademarks</h1>
</div>
<p>Adobe, Flash, Flex, Flex Builder, PostScript and Reader are
either registered trademarks or trademarks of Adobe Systems
Incorporated in the United States and/or other countries.</p>
<p>Apache is a trademark of The Apache Software Foundation.</p>
<p>Firefox and Mozilla are registered trademarks of the Mozilla
Foundation.</p>
<p>JavaScript is a trademark of Oracle Corporation.</p>
<p>Microsoft, Active Directory, Excel, Internet Explorer, Outlook,
PowerPoint, SQL Server, Windows, and Windows Vista are either
registered trademarks or trademarks of Microsoft Corporation in the
United States and/or other countries.</p>
<p>MySQL is a trademark of Oracle Corporation and/or its
affiliates.</p>
<p>Oracle, Java and OpenOffice.org are registered trademarks of
Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.</p>
<p>Progress and OpenEdge are trademarks or registered trademarks of
Progress Software Corporation or one of its subsidiaries or affiliates
in the U.S. and other countries.</p>
<p>Red Hat and JBoss are registered trademarks of Red Hat, Inc. in
the United States and other countries.</p>
<p>Any other third-party trademarks are the property of their
respective owners.</p>
<p> </p>
</div>
name
var sortingFields = new Array("name_cli");
dataset = factory.getDataset("cad_cli", null, constraints, sortingFields); |