Jump to content
We've recently updated our Privacy Statement, available here ×

XML/CSV data source filename/URL as Parameter


raja_s_patil

Recommended Posts

Hi,

 

I have downloaded ver 3.5.2 and installed it on both windows

and Linux and have tried for couple of days to evaluate it as

reporting tool for our project in flex.

I found it much interesting as far as XML (file as well remote)

datasource is concerned and I think I will be using mostly

remote XML data source. As of designing reports we will be using

local XML file with test data but for production report it should use

actual XML data which will be generated dynamicaly with help of

PHP or other serverside technology with different names at different times.

 

What we want to do is Pass that file's name as parameter while invoking the

report at runtime and delete it as soon as report finishes.

 

is it possible with ireport/japserreport ? if yes how can I do that ?

 

Thanks and best regards

 

Raja

Link to comment
Share on other sites

  • Replies 12
  • Created
  • Last Reply

Top Posters In This Topic

 

The file will be handled in general by your application that will instance a JRXmlDatasource passing the file and will delete it at the end of the report creation.

I suggest you to take a look at the xpath2 language. This is a special version of the xpath language provided by jasperreports and is provided as jasperreports-extension. With this language you can set the parameter XML_URL, and it will be used as location to get the xml data to use with the xpath query set in the report. The XML_URL can even be something like file:///C:\test.xml if you want to use local files.
This special query executer has actually more features. You can define parameters with the prefix XML_GET_PARAM to pass parameters along with the URL, so for instance you can define a parameter XML_GET_PARAM_CustomerID, and the parameter CustomerID will be passed in the url. Same thing using XML_POST_PARAM_Something, in that case the query executer will use a POST request to get the file. So in example you can have:

XML_URL = http://myserver/generate_customer_data.php
XML_GET_PARAM_CustomerID = 5

Final url used to get the xml:  http://myserver/generate_customer_data.php?CustomerID=5

Of course you can have as many parameters you want.

Attached there is a simple jrxml that is able to show the titles in a rss document. Execute it using a Query Executer Mode data source. When iReport prompts for the parameter XML_URL, set the url of an rss file or use the default value which points to an RSS file here on jasperforge.org.
 

Giulio

Link to comment
Share on other sites

Thanks Giulio,

 

Well thing turned out to be simpler than I expected. My impression is the product is based on

well thought design and I am sure that more things will come as this one down the line. /tools/fckeditor/editor/images/smiley/msn/teeth_smile.gif

So I have almost on the verge of finalizing JasperReports/iReport as reporting environment

for our first web project.

What I would like to know is,

1. Where can I find documentation for iReport and jasperreport.

    I searched site but I could not much of it May be My efforts lack somewhere

   so i will be gratefull if u give me some urls

2. How can I run my reports from flex application.

    I have chosen Flex/Air for UI and PHP->AdoDB for server side. For display information

    I am using RPC with amfPHP. I would like to make application database independent

    so we are enclosing all business logic in PHP scripts so is true for Reporting business

    logic. We plan to retrieve base data from databse with adodb and process it in PHP

    and finally spitout XML which either can be stored in disk file or directly consumed

    by reporting solution. What we need is reporting solution should take the data sequentially

    and generate report either by grouping or plain columner for almost 95% reports in the

    application very few require master-detail kind of facility.

    so in this scenario can u guide me about how Shall I proceed. BTW if flex application makes

    a call to either serverside viewer and if viewer is able to preview report in a separate tab or

    window is OK for me. otherwise if server side reprting runtime is able to send txt/PDF/xls/doc

    file directly to caller depending on parameter passed while calling which user should be able

    to save/print locally is also OK to me

3. If I notice some bugs where can I log them

 

Thanks once again for speedy response and best regards/tools/fckeditor/editor/images/smiley/msn/thumbs_up.gif

 

Raja

Link to comment
Share on other sites

1. www.jasperforge.com (the official manuals are not free, but the price is really reasonable give the amout of information they provide)

2. Solution 1: simple java deamon that read request for report execution from a db
Solution 2: java + PHP integration (you can write a generic simple java class to create the reports and instance and call it from PHP)
Solution 3: JasperServer + WebServices call from PHP (or other component supporting web services) to execute the reports and get back your favorite file format to be sent to the client

3. Bugs can be submit using the Tracker tool (see the menu on top of this page).

Giulio

 

Link to comment
Share on other sites

Thanks for speedy response,

No problem we can buy official manuals once we finalize on JasperReports.

>> Solution 1: simple java deamon that read request for report execution from a db<<

I have not understood what exactly this is. Can u ellaborate it ?

>>Solution 2: java + PHP integration (you can write a generic simple java class to create the reports and instance and call it from PHP)<<

This seems to be OK for us. Can u point us to some example/Tutorial URL. ?

We do not use java extensively for development but we will be able to manage writing few classes

for reporting purpose based on example code.

As per present scenario Solution 3 is not a viable from clients perspective but it has got

lot of value. We will keep this in mind and suggest this to our future prospective clients

 

Thanks and best regards

 

Raja

 

 

Link to comment
Share on other sites

Solution 1: simple java deamon that read request for report execution from a db
A daemon checks every few seconds if there are report job requests in a DB table. If a report execution request is found, a new thread will execute the report and will save it in the specified location. Not very good for report created immediatly.

Solution 2: I have not code sample, but you can find a sample about how to instance and use a method of a java class in PHP, while for the java portion, any sample in the JasperREports distribution has the code you need (see SampleApp.java files in each sample directory).

Giulio

Link to comment
Share on other sites

Thanks giulio,

I am reading material about PHP/Java Bridge and running jasperreport from PHP.

As of now I am able to run some java classes from PHP and going to try Jasper Report tommorow.

Meanwhile I would like to know Whether I can use jasperreport in a commercial Project

or there are any restrictions. Some articles suggest that some of the Jars in JapserReport

can not be used in commercial projects. can u comment on things which can be used in

commercial projects freely.

Regarding main topic issue  I will comeback after I am able to run jasperReport from PHP

 

Thanks and best regards.

Raja

Link to comment
Share on other sites

For what I know (and I'm pretty sure about that), all the jars shipped with JasperReports have a license which allows you to use them in a commercial product, included JasperReports itself, which is LGPL.

iReport is GPL, this means that you can use it to create your reports, but it can not be shipped as part of your product.

Giulio

Link to comment
Share on other sites

Thanks giulio,

What I have understood is The reports designed with iReport can be distributed with a

commercial product but iReport itself can not be Distributed in a commercial product.

JasperReport Jars can be freely distributed with Commercial product.

Please comment if I am under wrong impression.

 

Today i will try PHP/Java Bridge -> JasperReport and if necessary I will post about it

 

Thanks and best regards

 

Raja

Link to comment
Share on other sites

Thanks Giulio,

 

I am studying jasperreport from a Book "Definitive Guide" and very much

impressed by the basic design developers have adopted. What I can say

is its a "Master Piece Created by Genious" for database application developers.

Its ease of use for Programmers, Functionality and Flexibility is enormous.

 

I dont know much about developers of jasperreport but I guess that they must

have developed and implemented lot of database applications.

 

Best Regards.

 

Raja.

 

Link to comment
Share on other sites

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...