-3

I need to include procedural code to get data from database. Example: use for/while loops, if conditions, open and close "cursor" data, to create a program that runs and obtains results. This result is used to fill the report fields. How can I do? How can I include the procedural code?

Angelo
  • 1
  • 1

2 Answers2

0

I would do it like this:

  • Create an empty table on the database to get the field information for Jaspersoft
  • Create another report and add the actual report (which takes the data from the table and displays it) as a subreport
  • Code a little Java Scriptlet ith all your program logic. This should contain a "insert" command into the above mentioned table
  • Run this Scriptlet in the top-level report

Voila, that's it.

You can find information about Scriptlets in Jaspersoft here and here (and on Google).

Markus Deindl
  • 318
  • 1
  • 8
0

You can use custom component, and write a javascript code.

It is not easy to understand the correct way to do it, but you can learn from the samples provided on jaspersoft community.

If you are querying from an oracle database (from an enough recent version), you also can use user defined functions in your queries, witch is the simplest way to reach your goal.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459