Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the total row count?

I want to get total row count in iReport. The intention is to print a label based on the total row count.

My Format is like this (Assume that there are 10 records):

    This is page 1

    No Name Add
    1  ---- ---
    2  ---- ---
    3  ---- ---
    4  ---- ---
    5  ---- ---

    cont...2


    This is page 2

    No Name Add
    6  ---- ---
    7  ---- ---
    8  ---- ---
    9  ---- ---
    10 ---- ---

How do I get all record count before printing the report?

like image 379
Anand Soni Avatar asked Mar 24 '12 10:03

Anand Soni


People also ask

How do I total the number of rows in Excel?

If you need to sum a column or row of numbers, let Excel do the math for you. Select a cell next to the numbers you want to sum, click AutoSum on the Home tab, press Enter, and you're done. When you click AutoSum, Excel automatically enters a formula (that uses the SUM function) to sum the numbers.

How do I find the row count in a table?

To count the number of rows, the “#Table_Id tr” selector is used. It selects all the <tr> elements in the table. This includes the row that contains the heading of the table. The length property is used on the selected elements to get the number of rows.

How can I count total rows in SQL?

SQL COUNT(), AVG() and SUM() FunctionsThe COUNT() function returns the number of rows that matches a specified criterion.


2 Answers

Use the built-in variable iReport $V{REPORT_COUNT}.

Also, if you're interested in the final value, set the text field's evaluation time to "Report".

like image 184
mdahlman Avatar answered Oct 25 '22 20:10

mdahlman


Put the $V{REPORT_COUNT} in the detail section of your report along with your other fields.

It will display the values in sequence as you mentioned in your question.

  1. create a variable drag and drop
  2. in the detail section right click on the item
  3. click on edit expressions
  4. in fx variables you will see REPORT_COUNT
like image 39
Meeza S Avatar answered Oct 25 '22 20:10

Meeza S