1
votes

How does Jasper report works while fetching the value from database. I know that detail band gets repeated for each row but my question is:

1) Do all DB rows gets fetched first and then detail band gets repeated for each row.

                        or

2) It is parallel process as soon as report gets one row it creates new detail band.

Why I am asking these question is, I want to do some operation through all rows on basis of that there is one element in my detail band which should be printed or not in each band.

Example: suppose my DB always returns two rows, one for public and one for private, and out of which I have to compare one column, say name as overall_score as below:

1) If private overall_score is greater than public the header private should be underlined.
2) if public overall_score is greater than private the header public should be underlined.
3) if both overall_score are equals both header should be underline.

I have one line element on detail band on which I want to put printWhenexpression on the basis of comparison of overall_score for both the rows.

Please help me I am new to Jasper Report.

1

1 Answers

1
votes

You could try this.

  1. Create a Group on whatever field is common on the record pairs. You could set the height to zero of the Group Header and Footer bands if you do not want to have them show on the report.
  2. Create a variable that gets the max overall_score value for each group.
  3. In your PrintWhenExpression, compare the overall_score of the current record to the variable containing the max overall_score for the group.