java - Removing null elements and keeping non-null elements together on a list in jasper reports -


i using jrbeancollectiondatasource datasource subreport. each record in list contains elements either null or non-null value . pojo:

public class payslipdtl {          private string earningsalaryheadname;         private double earningsalaryheadamount;          private string deductionsalaryheadname;         private double deductionsalaryheadamount;          string type;  public payslipdtl(string salaryheadname,             double salaryheadamount, string type) {         if(type.equalsignorecase("earning")) {             earningsalaryheadname = salaryheadname;             earningsalaryheadamount = salaryheadamount;          } else {              deductionsalaryheadname = salaryheadamount;             deductionsalaryheadamount = salaryheadamount;         }     }          //getters , setters         } 

based on "type", list populated such: {"basic", 4755, null, 0.0}, {"hra", 300, null, 0.0}, {null, 0.0, "employee pf", 925}, {"medical allowance", 900, null, 0.0} , on...

after setting isblankwhennull true , using "print when" expression, record displayed such:

|earning            |amount|deduction            |amount| --------------------|------|---------------------|------| | basic             | 4755 |                     |      | | hra               | 300  |                     |      | |                   |      | employee pf         |  925 | | medical allowance | 900  |                     |      | | fuel reimbursement| 350  |                     |      | |                   |      | loan                | 1000 | --------------------------------------------------------- 

i want displayed such:

|earning            |amount|deduction            |amount| --------------------|------|---------------------|------| | basic             | 4755 |  employee pf        |  925 | | hra               | 300  |  loan               | 1000 | | medical allowance | 900  |                     |      | | fuel reimbursement| 350  |                     |      | --------------------------------------------------------- 

setting isremovelinewhenblank true doesn't work since not entire row blank subset of elements of row null.

is possible in jasper?

i using ireport designer 5.0.1 compatibility set jasperreports3.5.1.

use list component deduction/amount, here have video tutorial on how this.

then deduction , amount fields on list component need following options blank when null , remove line when blank.

if still gives blank lines, try putting both fields on frame inside list , mark options frame too.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -