View Full Version : run-time value

09-05-2002, 09:57 PM
Is it possible to get a run-time value, when generating the report ?

For example: You want to generate the report according to a particular customer's history. The table contains the date, where, what about the history. But the table doesn't contain the customer's name. So I would like to generate the report with the customer's name as title. Is that possible ?

09-06-2002, 05:31 AM
You should be able to use the setProperty(...) method in the JFreeReport class, before you generate your report, for example:

myReport.setProperty("customer.name", "Dave Gilbert");

Then define a ReportPropertyFunction in your XML report template:

<function name="customer_name" class="com.jrefinery.report.function.ReportPropertyFunction">
<property name="reportProperty">customer.name</property>

And then you can include a field in any band of your report, to print out the value of this property:

<string-function name="custname" x="0" y="0" width="150" height="14" alignment="left" function="customer_name" />



09-06-2002, 09:16 AM
I got it .. Thank You ..

09-14-2002, 06:26 AM

the JFreeReport expects sorted columns which are to be grouped....

But TableModel doesnt support it.....

So could u please tell me a way how to do it....

09-14-2002, 10:19 AM

a question: Do you use a default tablemodel or have you implemented your own model?

If you are using a default tablemodel try to use the ColumnSorter posted in the parallel thread here: http://www.object-refinery.com/phorum-3.3.2a/read.php?f=7&i=505&t=499

If you are not using the DefaultTableModel, it depends on your model implementation. But in general it is safe to say that when you feed the data into the model in an ordered way, you'll get it out of the model in an ordered way.

If you are using a database as datasource, you can use the "order by" construct to sort the resultset.

Have more fun,
said Thomas