PDA

View Full Version : Sending result set to an xaction ...



agoraplus
08-23-2006, 07:31 AM
We're developing a Web program with Oracle database and we're looking for a way to pass at least 100 results to an xaction in order to display a jasper report.
So what we want to do is write the SQL query in our application (with a home made query builder) and then send the result set to an xaction that will use Jasper reports to format the result in various file types (pdf, csv etc etc)
We can't write sql queries in Jasper reports.
Do you have any solution to this kind of problem ?

mbatchelor
08-23-2006, 02:25 PM
Have you looked at our demo application? In the test solution is several examples of running a query within the platform, and having Jasper Reports execute results based on that query.

Unless I'm missing something, this is already built-in and ready to go.

Take care,

Marc

mbatchelor
08-24-2006, 06:53 AM
Let me clarify/correct my answer from above.

In the platform, you can pass queries as inputs to an action sequence (xaction). The JasperReportsComponent will use the connection information supplied in the action sequence (or passed in as a parameter) to get the connection and query gets passed into Jasper Reports.

If you're saying that you need to pass in a resultset (that is, passing in the query to use is insufficient), then the JasperReportComponent currently doesn't support that. Relatively simple changes to that component would allow that functionality.

Sorry for misreading the question.

agoraplus
08-29-2006, 07:22 AM
Thx for your answer.

I'm trying your first solution. My query is provided by an oracle procedure in XML format.

I already saw your sample "XQ_Datasource.xaction". I used the "Xquery" action to recover my query from the oracle procedure.

But I don't know how to pass the query as a parameter to my Jasperreport.

Is there a way to transform the "Xquery" result to a parameter for jasperreport ?

My xml content :

<?xml version="1.0" encoding="windows-1252" standalone="yes"?>
<query>
<value>
SELECT TO_CHAR(SYSDATE,'DD fmMONTH YYYY') cur_date FROM dual
</value>
</query>

My xaction content :

<?xml version="1.0" encoding="UTF-8"?>
<action-sequence>
<inputs/>

<outputs>
<rule-result>
<type>list</type>
</rule-result>
</outputs>

<resources>
<document>
<url>
<location>http://127.0.0.1/acti/pck_gestion.testxml</location>
<mime-type>text/xml</mime-type>
</url>
</document>
</resources>

<actions>
<action-definition>
<component-name>XQueryLookupRule</component-name>
<action-type>XQuery</action-type>
<action-resources>
<document type="resource"/>
</action-resources>
<action-outputs>
<rule-result type="list"/>
</action-outputs>
<component-definition>
<query><![CDATA[/query/value]]></query>
</component-definition>
</action-definition>

<action-definition>
<component-name>JasperReportsComponent</component-name>
<action-type>Jasper Report</action-type>
<component-definition>
<output-type>html</output-type>
</component-definition>
</action-definition>

</actions>
</action-sequence>

jdixon
08-29-2006, 08:22 AM
I think you will find it easier to do this using JFreeReport as you can pass the query, or the data to the JFreeReportComponent. This is not possible with the JasperReportComponent.

James