Limiting the number of data rows displayed

By: robert casson - rcasson
Limiting the number of data rows displayed
2002-12-11 10:15
Teodor, Thanks for the quick response. It is really appreciated. I have one more question. I have purchased and perused the documentation and cannot find a way of limiting the number of data rows displayed (limiting the result set is not possible). The only way I see to accomplish this is using the printWhenExpression in each report element. But when I try to use the operator <=, the parser rejects the expression. It will take == and >=. There must be a more elegant way.

Thanks




By: Teodor Danciu - teodord
RE: Limiting the number of data rows displayed
2002-12-11 23:11

Hi,

Here's the solution for your <= problem.

http://jasperreports.sourceforge.net/faq.html#faq3

A more elegant way to limit the report generation
to the certain number of records is to create a more
"intelligent" data source imprelentation that would
stop when reaching the given row count.

I'll probably introduce this feature in future versions.

Thank you,
Teodor





By: robert casson - rcasson
RE: Limiting the number of data rows displayed
2002-12-12 14:38
That did the job, thanks. Now that I can suppressed report elements from displaying, how would/can I assign the REPORT_COUNT variable the number of rows displayed before the while the printWhenExpression value criteria was met. In other words say the expression limits the maximum number of rows to 10 but the data source has 20, the REPORT_COUNT will iterate through all rows and assign 20 to the variable. I want it to show only the 10 rows.

Thanks




By: Teodor Danciu - teodord
RE: Limiting the number of data rows displayed
2002-12-12 23:26

Hi,

Define your own count variable like this:

<variable name="MyReportCount" resetType="Report" calculation="Count">
<variableExpression>($V{REPORT_COUNT}.intValue() > 99)?(null):(Boolean.TRUE)</variableExpression>
</variable>

Instead of 99, you put your own limit, maybe
using a parameter value.

Never tested it, but it should work.

Good luck!
Teodor





By: robert casson - rcasson
RE: Limiting the number of data rows displayed
2002-12-13 07:33
Teodor, your solution works well. Thanks for all your help.




By: robert casson - rcasson
RE: Limiting the number of data rows displayed
2002-12-13 16:11
Currently I am grouping on a field value expression. I assume it is possible to use a compund expression to force a rupture on the new filed value or as can be seen above, a variable value threshold (such as count). Basically, I want to cause a premature rupture based on record count and a field value. What would such an expression looks like?




By: Teodor Danciu - teodord
RE: Limiting the number of data rows displayed
2002-12-30 03:24

Hi,

All you have to know is that group ruptures occur
when the value returned by the group expression
changes with the new iteration in the data source.
Also, note that all report expressions are pure Java
expressions, so you could use the conditional
operator ?: or make method calls.

You have to use your imagination to obtain
the exact group ruptures in your reports.

I hope this helps.
Teodor
2006 IR Open Dicussion's picture
Joined: Aug 10 2006 - 3:24am
Last seen: 17 years 1 month ago

0 Answers:

No answers yet
Feedback
randomness