Add row counter in output for datatable

How would one add a row counter on the output of a datatable component.
The datatable will be populated from a database resultset
The out put should be as follows
1 data columns .......
2 data columns .......
3 data columns ........
<h:dataTable value="#{register.newregistrations}" var="payment">
<h:column>
     <h:outputText value="#{payment.counter}"> <<<< what can I replace this with ????
     </h:outputText>
</h:column>
<h:column>
     <h:outputText value="#{payment.expiry_date}">
     </h:outputText>
</h:column>
</h:dataTable>
How do I create the row counter .

The Following post is a solution
http://forum.java.sun.com/thread.jspa?forumID=427&threadID=549084

Similar Messages

  • How to add rows in table control for data recording BDC?

    hello,
    pl tell me the way to upload data through BDC in table control of screen .
    how to add fields inrecording of table control?
    Please give some code in this regard.
    I am generous in giving points..pl help!

    Hi,
    While doing code under recording first you need to do the recording with sample data under a particular transaction like T-code XK01 (Vendor creation).
    Take an example of create vendor using T-code XK01:
    Go to t-code 'SHDB' under make recording for XK01 with sample data and once if you complete the recording means after vendor creation check the source code bye by pressing the button  'Program', it shows the total coding for recording of what you entered the test data.
    Then you will create one program and copy that source code of recording into your program, and now you have to remove the values at perform statement and give the internal table field name.
    Like that you can develop your own code along with your validations.
    my best suggestion is don’t see the example code of recording method because any one for standard t-code should get the code from recording with sample data, so first tryout with your own recording method and you can understand the code step by step.
    With these I hope you will get some idea of recoding method.
    Let me know for further doubts.
    Regards,
    Vijay.

  • Add row in the middle of Datatable

    Hi
    my requirement is i've to display a table in following fashion:
    Product_catagory   product_name    Price
        cat1              p1          10
                          p2           10
                          p3         20
                           Sub_Total    40
        cat2              p4          15
                          p5            10
                           Sub_Total   25
        cat3               p33          10
                           Sub_Total    10how can i achieve the Sub_total display...
    Thanks in advance
    Fareen

    <h:column>
        <h:outputText value="#{product.name}" />
        <br />
        Subtotal
    </h:column>
    <h:column>
        <h:outputText value="#{product.price}" />
        <br />
        <h:outputText value="#{bean.subtotal}" />
    </h:column>or so.
    You can also use a <h:panelGrid column="1"> here, but that renders another table in a table. You can also use plain vanilla HTML with c:forEach here if you're using at least JSF 1.2.

  • DataTable.Rows.Count property is occasionally wrong

    I have a web service in C#.NET which calls a stored procedure using ADO.NET. The stored procedure is always returning 1 row, which is then loaded into a DataTable. The Rows.Count property of the DataTable is then examined.
    When this web service is called repeatedly with numerous requests, it occasionally returns Rows.Count as 0 when it should be 1. I have debugged and examined it at runtime and found that there is indeed 1 row in the datatable, but that the Rows.Count property
    is 0.
    Is this a known bug?
    I'm using .Net Framework 2.0
    Note: This is an issue that occurs very rarely. My testing shows that it takes about 90 minutes to recreate it when you have 2 concurrent processes sending requests repeatedly at a rate of about 10 requests per second.

    Are you sure that there aren't multiple threads access the DataTable?
    Can you post a repro? 
    David
    David http://blogs.msdn.com/b/dbrowne/

  • Report.Services 2008 - get page-count or row-count in the c#-code

    hello
    is it possible to get from the ReportViewer-control / ServerReport the page-count or row-count after the
    reportViewerCheck.ServerReport.Refresh();
    statement ??
    many thanks in advance for any clue & regards
    Michael

    Hi Michael,
    Yes, you can get them. For row count, you can add a parameter to store the row count of your dataset in your report.
    Here are the steps:
    1.     Add 2 datasets in your report, one for report use and the other on is to row count use. For instance:
    DataSet1: SELECT     HumanResources.vEmployee.* FROM         HumanResources.vEmployee
    DataSet2: SELECT     COUNT(*) FROM         HumanResources.vEmployee
    2.     Add a parameter, set the parameter’s default value set to Get Values from a query and select DataSet2.
    Then, in your ASP.NET web application code you can use the following function to get the row count of the report:
    private int GetReportRowCount(ReportViewer report)
                return Convert.ToInt32(report.ServerReport.GetParameters()[0].Values[0].ToString());
    For page count, you can refer to the following code:
    private int GetReportPageCount(ReportViewer report)
                return report.ServerReport.GetTotalPages();
    You may not get the correct row count and page count in after executing Refresh () method, that’s because when you run this method, it will start another thread to refresh the report and the code below Refresh () method will not wait refreshing complete but run it. For instance, you may get the page count as o if you run the following code in the Button event:
    // Click this Button to refresh the ReportViewer1
            protected void btnGetPageCount_Click(object sender, EventArgs e)
                // Refresh the ReportViewer1
                this.ReportViewer1.ServerReport.Refresh();
                // Get ReportViewer1's page count and display in the txtPageCount TextBox
                this.txtPageCount.Text = this.ReportViewer1.ServerReport.GetTotalPages().ToString();
    You can run the refresh in separate events and get page count in another event, such as below code:
            // Click this Button to refresh the ReportViewer1
            protected void btnGetPageCount_Click(object sender, EventArgs e)
                // Refresh the ReportViewer1
                this.ReportViewer1.ServerReport.Refresh();
            // Display the txtPageCount's text to ReportViewer's page count
            protected void btnGetPageCount2_Click(object sender, EventArgs e)
                // Get ReportViewer1's page count and display in the txtPageCount TextBox
                this.txtPageCount.Text = this.ReportViewer1.ServerReport.GetTotalPages().ToString();
    Hope this helps! I would suggest you post a new thread in Visual Studio Report Controls forum if you need more help about using ReportViewer in ASP.NET web application.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • View Data & Updating row count

    Hi,
    iam using OBIEE 11g, when iam importing data from sysbase into physical layer then in the physical layer i cant able to view data and update row count also.
    For sysbase which dataconnection we have to use i.e (ODBC 3.5, OCI 10g/11g).
    for ODBC 3.5 connection is established but we cant get data i.e (view data in Physical layer ), for OCI 11g we cant establish a connection.
    Thanks in advance.
    prakash

    Hi,
    *• Relational Database System* including Oracle Database, Oracle Exadata Database Machine, Oracle TimesTen In Memory Database, DB2, Microsoft SQL Server, Teradata, Netezza, Informix, Sybase and other ODBC compliant data sources
    *• OLAP Sources* including Oracle Essbase, Hyperion Financial Management, Oracle Database OLAP Services, Oracle RPAS, Microsoft Analysis Services Cubes, and SAP BW Infocubes.
    *• XML Data Sources* including access to other types of data servers (e.g., other non-relational servers), Microsoft Excel spreadsheets, and Web Services.
    So, we should use ODBC 3.5 as Call Interface for Sybase.
    Thanks,
    Balaa...

  • Getting row count of file into table column

    Hi experts,
    I want to insert the row count of the file into a table column for generating a summary file containing the detials of all the files generated for the day along with the row count and also for audit purpose.
    My design is to create table in the summary file format & update the data's in it then using OdiSqlUnload to generate the required summary file, for this purpose I need to insert the row count of the file generated.
    I tried to get the row count using the http://odiexperts.com/get-file-length-and-header-in-operator post. But passing the "lines" value into a ODI variable or inserting into a table column is not working.
    Please help or suggest what can be done to achive the above scenario.
    Thanks in advance.

    There are a few excellent examples at :- COUNT
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • How to add a comment for each row on the output of a report?

    I would like to add a comment (field) for each row on the output of report? This comment should to be saved as well. Is there a way i can do that?
    Regards,
    Ram

    Hi Dimitri,
    through the instead of trigger functionality i am able to update the view. This is view is based on different views which should be linked to a table (as you suggested) in which comments can be stored. Hower this table is empty and how to link this table with the view now? I face the following challenge.
    View consists the following columns, for example
    select name, sex, age from test_view
    name sex age
    John M 20
    Anton M 30
    Willy M 40
    shirley F 38
    sharon F 37
    The report has the following output, for example
    name     sex age
    John     M 20
    Anton     M 30
    Willy M 40
    Shirley F 38
    Sharon F 37
    Now i would like to add comment through a button.
    The report layout looks like
    name sex age
    John M 20 <add comment button>
    After submitting the <add comment button> you can enter text which deals with John
    text='John doesnot like me'
    Finally the report display the comment as well
    name sex age
    John M 20 'John doesnot like me' <update/delete comment button>
    Anton M 30 <add comment button>
    Willy M 40 <add comment button>
    Shirley F 38 <add comment button>
    Sharon F 37 <add comment button>
    After submitting the <update/delete button> you can change or delete the entered text.
    I hope this example clears things up.
    Regards,
    Ram

  • Is there a way to add a column after a filled DataTable from SQL with the same rows?

    My problem is that not to add rows like filled by SQLDataAdapter at the same row in DataGridView. How to make that? I showed below the details with my code also a screen shot, which shows the rows differences from the origin one.
    I don't want to add an expression as column behave in my sql script to get what I need with query result. I don't want to obtain that way.
    using (SqlConnection c = new SqlConnection(ConnStrMSSQL))
    c.Open();
    // 2
    // Create new DataAdapter
    using (SqlDataAdapter a = new SqlDataAdapter("SELECT SIPNO, SERINO, TARIH FROM SNOHAREKETLER WHERE Cast(TARIH as DATE) BETWEEN '2015/03/20' AND '2015/03/20' AND (TEZNO = 'T23' OR TEZNO = 'T31') AND CIKTI is null", c))
    // 3
    // Use DataAdapter to fill DataTable
    DataTable t = new DataTable();
    a.Fill(t);
    t.Columns.Add("MyColumn", typeof(string));
    DataRow workRow;
    int iGetCount = t.Rows.Count;
    for (int i = 0; i <= iGetCount - 1; i++)
    workRow = t.NewRow();
    workRow["MyColumn"] = i;
    t.Rows.Add(workRow);
    dataGridView1.DataSource = t;

    The extra column isn't applied to only certain rows.  The columns of a table identify what data each row will contain.  Hence adding a column to the table automatically adds them to the rows.  What you're seeing is that all the initial rows
    aren't being assigned a value so they retain their default value of null.  Later you enumerate the rows of the existing table and call AddRow which adds new rows.  This isn't adding columns, but rows.
    To generate values for the existing rows you should ideally simply pass the data back from the database.  DT computed columns can be difficult to set up as it is limited to what it can do.  If you want to use a computed column on the Datatable
    itself then define the column as a computed column and every row will calculate its own value.
    DataTable data = GetData();
    //Add elapsed time column
    var col = new DataColumn("ElapsedTime", typeof(TimeSpan), "expr");
    data.Columns.Add(col);
    dataGridView1.DataSource = data;
    The issue you will run into however is that calculating a diff on DateTime doesn't work in a computed column as the expression doesn't support the necessary functions.  You can google for how people solved this if you are interested in alternatives. 
    Most people just tend to add the column and then hook into the various change events to update the value as needed.

  • How to get row count(*) for each table that matches a pattern

    I have the following query that returns all tables that match a pattern (tablename_ and then 4 digits). I also want to return the row counts for these tables.
    Currently a single column is returned: tablename. I want to add the column RowCount.
    DECLARE @SQLCommand nvarchar(4000)
    DECLARE @TableName varchar(128)
    SET @TableName = 'ods_TTstat_master' --<<<<<< change this to a table name
    SET @SQLCommand = 'SELECT [name] as zhistTables FROM dbo.sysobjects WHERE name like ''%' + @TableName + '%'' and objectproperty(id,N''IsUserTable'')=1 ORDER BY name DESC'
    EXEC sp_executesql @SQLCommand

    The like operator requires a string operand.
    http://msdn.microsoft.com/en-us/library/ms179859.aspx
    Example:
    DECLARE @Like varchar(50) = '%frame%';
    SELECT * FROM Production.Product WHERE Name like @Like;
    -- (79 row(s) affected)
    For variable use, apply dynamic SQL:
    http://www.sqlusa.com/bestpractices/datetimeconversion/
    Rows count all tables:
    http://www.sqlusa.com/bestpractices2005/alltablesrowcount/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Cursor ORDER BY Clause Changing Row Count In BULK COLLECT ... FOR LOOP?

    Oracle 10g Enterprise Edition Release 10.2.0.4.0 running on Windows Server 2003
    Oracle Client 10.2.0.2.0 running on Windows 2000
    I have some PL/SQL code that's intended to update a column in a table based on a lookup from another table. I started out by testing it with the UPDATE statement commented out, just visually inspecting the DBMS_OUTPUT results to see if it was sane. During this testing I added/changed the cursor ORDER BY clause to make it easier to read the output, and saw some strange results. I've run the code 3 times with:
    1. no ORDER BY clause
    2. ORDER BY with two columns (neither indexed)
    3. ORDER BY with one column (not indexed)
    and get three different "rows updated" counts - in fact, when using the ORDER BY clauses it appears that the code is processing more rows than without either ORDER BY clause. I'm wondering why adding / changing an ORDER BY <non-indexed column> clause in a cursor would affect the row count?
    The code structure is:
    TYPE my_Table_t IS TABLE OF table1%ROWTYPE ;
    my_Table my_Table_t ;
    CURSOR my_Cursor IS SELECT * FROM table1 ; -- initial case - no ORDER BY clause
    -- ORDER BY table1.column1, table1.column2 ; -- neither column indexed
    -- ORDER BY table1.column2 ; -- column not indexed
    my_Loop_Count NUMBER := 0 ;
    OPEN my_Cursor ;
    LOOP
    FETCH my_Cursor BULK COLLECT INTO my_Table LIMIT 100 ;
    EXIT WHEN my_Table.COUNT = 0 ;
    FOR i IN 1..my_Table.COUNT LOOP
    my_New_Value := <call a pkg.funct to retrieve expected value from another table> ;
    EXIT WHEN my_New_Value IS NULL ;
    EXIT WHEN my_New_Value = <an undesirable value> ;
    IF my_New_Value <> my_Table(i).column3 THEN
    DBMS_OUTPUT.PUT_LINE( 'Changing ' || my_Table(i).column3 || ' to ' || my_New_Value ) ;
    UPDATE table1 SET column3 = my_New_Value WHERE column_pk = my_Table(i).column_pk ;
    my_Loop_Count := my_Loop_Count + 1 ;
    END IF ;
    END LOOP ;
    COMMIT ;
    END LOOP ;
    CLOSE my_Cursor ;
    DBMS_OUTPUT.PUT_LINE( 'Processed ' || my_Loop_Count || ' Rows ' ) ;

    Hello (and welcome),
    Your handling the inner cursor exit control is suspect, which will result in (seemingly) erratic record counts.
    Instead of:
    LOOP
    FETCH my_Cursor BULK COLLECT INTO my_Table LIMIT 100 ;
    EXIT WHEN my_Table.COUNT = 0 ;
    FOR i IN 1..my_Table.COUNT LOOP
    my_New_Value := <call a pkg.funct to retrieve expected value from another table> ;
    EXIT WHEN my_New_Value IS NULL ;
    EXIT WHEN my_New_Value = <an undesirable value> ;
    IF my_New_Value my_Table(i).column3 THEN
    DBMS_OUTPUT.PUT_LINE( 'Changing ' || my_Table(i).column3 || ' to ' || my_New_Value ) ;
    UPDATE table1 SET column3 = my_New_Value WHERE column_pk = my_Table(i).column_pk ;
    my_Loop_Count := my_Loop_Count + 1 ;
    END IF ;
    END LOOP ;
    COMMIT ;
    END LOOP ;Try this:
    LOOP
    FETCH my_Cursor BULK COLLECT INTO my_Table LIMIT 100 ;
    FOR i IN 1..my_Table.COUNT LOOP
    my_New_Value := <call a pkg.funct to retrieve expected value from another table> ;
    EXIT WHEN my_New_Value IS NULL ;
    EXIT WHEN my_New_Value = <an undesirable value> ;
    IF my_New_Value my_Table(i).column3 THEN
    DBMS_OUTPUT.PUT_LINE( 'Changing ' || my_Table(i).column3 || ' to ' || my_New_Value ) ;
    UPDATE table1 SET column3 = my_New_Value WHERE column_pk = my_Table(i).column_pk ;
    my_Loop_Count := my_Loop_Count + 1 ;
    END IF ;
    EXIT WHEN my_Cursor%NOTFOUND;
    END LOOP ;
    END LOOP ;
    COMMIT ;Which also takes the COMMIT outside of the LOOP -- try to never have a COMMIT inside of any LOOP.
    Additionally, not too sure about these:
    my_New_Value := <call a pkg.funct to retrieve expected value from another table> ;
    EXIT WHEN my_New_Value IS NULL ;
    EXIT WHEN my_New_Value = <an undesirable value> ;Any one of those EXITs will bypass your my_Loop_Count increment.
    Edited by: SeánMacGC on Jul 9, 2009 8:37 AM
    Had the cursor not found in the wrong place, now corrected.

  • HTML DB SQL Workshop Output to csv Max Row Count

    I am using HTML DB 1.6 with Oracle 10g 10.1.0.3.0 On SuSE Linux Enterprise Server 9.
    When I execute a query in SQL Workshop SQL Command Processor that returns a result set of greater than 5,000 rows and click the Output to Excel link, it exports NO MORE than 5,000 records.
    In working through Metalink with Oracle Tech Support, apparently for Reports in HTML DB there is a way to change the Max Row Count default limitation of 5,0000. However, this isn't in a report. It is simply from the query results page in SQL Workshop. Tech Support has been unable to idnetify ANYWHERE where I can change the default Max Row Count for simply outputting the results to csv format through the Output to Excel link.
    I am desperately looking for where I can globally change this default that will allow me to use SQL Worskshop to output greater than 5,000 records from within SQL Workshop.
    Thanks for you help!
    Mike

    hi mikes--
    that sqlworkshop 5k row limit issue was corrected in htmldb 2.0. in 1.6.x, i'm pretty sure you're always limited to 5k no matter what you select for that Max Rows attribute.
    regards,
    raj

  • Rows count for repetitive groups in tablix.

    Hi All,
    To make the story cut short, i will going to explain my scenario:
    i have a tablis contro and i garoup it by a field say "Field1" which contains A and B values,
    in my case we divide groups in two parts if it has rows more then 200.
    so, my report output and my required is below :
    Current Output -------------------------- Required layout
    here 200, 20, 30 are number of rows per group.
    now my requirement is if a group is repetitive
    i need the all rows count for that value like in above case :
    Header text of  Group A should be like : A(220) i.e 200 +20
    please help me on this...
    it is very urgent for me
    shashank

    hi Simon,
    thanks for reply, sorry, i skipped to mentioned that i have to provide multilevel grouping also, like 
    Group By: Field 1 -> Field 2 -> field3
    so, to achieve my requirement by Sql as solution has no problem if i do not have multilevel grouping, but i have to provide that and in that case the query will be like,
    “select distinct [column1],[Column2],[Column3],count(*) as rn from [table] group by [column1],[Column2],[Column3]”
    which is problematic in my case.
    so for doing this i need a solution apart from sql but by using SSRS Report end.
    Thanks again.
    Shashank

  • Method for finding row count after executing query

    Is there a method for finding the row count from the resultset after executing a query on a database ?

    The best way: read the data from the result set. If you read it into e.g. a LinkedList, size() will tell you how many rows you got. Or you could increment a counter.
    There are other ways, such as variants of ResultSet that do the read loop for you. But since you'll be doing the fetch loop anyway, those just add unnecessary work and moving parts.

  • There was an error while updating row count for "SH".."SH".CHANNELS

    Hi All,
    Am new to OBIEE.Pls help in this regard.
    Am building the physical layer as per Repository guide.When am importing the data in to this,am getting the below error.
    *"There was an error while updating row count for "SH".."SH".CHANNELS" :"*
    channles is the table name and having 5 rows.
    but am able to see the data in the sql prompt. like SELECT * FROM SH.CHANNELS then 5 rows data would be displaying..
    pls help in this regard and where is the excat problem?
    Thanks,

    what is the error?
    Make sure that your connection pool settings are okay..
    Make sure that, you are using correct driver in case of if you are using ODBC dsn..
    Also make sure that, your oracle server is running... TNS and Oracle server services

Maybe you are looking for

  • Change Application Icon Size in iTunes.

    Can anyone tell me how to change the size of the application icons in iTunes so I wouldn't have to scroll and see them all at once? Thanks

  • Please HELP Lenovo G410 Cursor Problem

    Please help, iam experiencing a very annoying problem with my new lenovo G410 cursor behavior. At some time my cursor always jumps to another arear. for example when iam typing, at some time the cursor go to another area of the screen, and this reall

  • Tables - How many rows maximum

    Is there a maximum number of rows a table can have? I am working Dreamweaver MX 2004. I have a table with over 300 rows that is moving incredibly slow. And I still have another page that will have a 700 row table.- Goodness only knows if that will ev

  • JAXM API and JAXMServlet

    Hi, I'm learning to use Web Services. I have discovered Axis and this project looks great. But someone told me that I can extend JAXMServlet from JAXM API to manage my web service on server side. My web service will have only strings on input and out

  • General Error (41)

    I am having trouble opening a final cut project. I keep getting a general error (41) message yet my capture scratch is still intact. Any ideas how I can resolve this? Final Cut Pro 4.5 HD PowerBook   Mac OS X (10.3.9)