How to get summation of the database field using iReport

    
        First of all have to create a simple report and drag and drop the some fields. One field should be numeric field. Because, finally will take the summation of above numeric field.in the below created report going sum of the amount field.

          

          Drag and drop the static text to the report summary section and create new variable under variable menu.

            

            After created a variable, it listed under variable menu and drag and drop to the report summary section.

             

           Then go to the XML viewer and edit variable tag and add the variable Expression tag in the jrxml file.

             

              
In the variable tag
·         Name is the added variable’s name.
·         Class is the data type of the calculated field.
·         Calculation is summation of the given field.
                                In the Variable Expression tag
·         Display the field which want sum.

      Then save the report and compile. After that go to the Preview mode and see the out put.in the last page display the sum of the amount field. If compare with the data base both display the same value for the summation of the amount field.

        

 

How to get summation of the database field using iReport How to get summation of the database field using iReport Reviewed by Pubudu Dewagama on 10:54:00 PM Rating: 5

No comments: