java - Add Custom Calculations in the Column Footer using DynamicJasper in Excel report -


i using dynamicjasper ver 4.0.2 , i've created report in excel format.

the report having 3 columns let a, b , c.
in footer want total of column i.e. sum(a) , column b i.e. sum(b) while total of column c=(sum(b)/sum(a))*100.

however able add total column , b using drb.addglobalfootervariable(columna, djcalculation.sum) , drb.addglobalfootervariable(columnb, djcalculation.sum).

but i'm not able find solution columnc per formula explained above.

i googled didn't relevant post. please me.

i got solution using customexpression class in dynamic jasper.here example below,

     private abstractcolumn column_c;      dynamicreportbuilder drb = new dynamicreportbuilder();      column_c = columnbuilder.getnew().setcolumnproperty("columnc",double.class.getname()).settitle("c").setheaderstyle(headerstyle).setfixedwidth(false).setstyle(detailcurrencystyle).setpattern("###0.00;-###0.00").build();      drb.addglobalfootervariable(column_c, new customexpression() {                  @override                 public object evaluate(map fields, map variables, map parameters) {                     double totalofcolumnc = 0.00;                     totalofcolumnc = ( totalofcolumnb/ totalofcolumna) * 100;                     return totalofcolumnc;                  }                  @override                 public string getclassname() {                     return double.class.getname();                 }             }); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -