Count the rows in a list-component

Hi,
How can I count the rows with a value in a list component?
I thought it would be RowCount but as I figured out that shows the number of shown rows, not the number of rows with a value.

Hi,
Try list.dataProvider.length

Similar Messages

  • Count the rows which are selected ?

    Hi Experts,
    I need help.My requirement is:
    I am having a table which can be multiple selected. But there are two buttons attached to it.Edit and Delete.For Delete I want the Multiple Selection not for EDit.So, If i will click the Edit after multiple selection of the rows.How i can give pop-up that multiple edit is not possible?Means I want to count the rows which are selected how to do that?
    Please guide me.
    Urgent need
    Regards
    Nutan

    Hi Nutan,
    Marcel is right about backend. However I might have an idea once I am developing a quiet similar solution. I would like to ask you to explain with more detail. It seems you have two requirements in one question.
    Regards,
    Gilson

  • Counting the rows

    Hi,
    I've a datamodel with BI Query. I want count the rows like a rownum function. How can I do this?
    Thanks R.
    Edited by: user12003776 on Jan 26, 2012 5:02 PM

    Do you want to get a count of rows in the query or do you want to find the count in the template? Rownum function returns the rows' position.
    If you want to find the count of rows within the template for some conditionally formatting, then you could use something similar to this:
    <?count(/XXTA_SHIP_LABEL/LIST_G_CUSTOMER/G_CUSTOMER)?> -- change the path to the field in your dataset
    Can you explain a bit more as to what you are trying to do?
    Thanks,
    Bipuser

  • Does anyone know how to remove the separator in AddRemove List component?

    I tried many things but none seem to work. I tried
    addRemoveList1.setSeparators(false) and this didn't do anything. Our UI Designer does not like the separator to be at the bottom of both list boxes, so is there a way to make it disappear. I don't think there are any facets on the separator.
    Thanks

    What version of Pages and what demo?
    Peter

  • Is it possible to count the rows returned from a query?

    Hello,
    When using JDBC is there anyway of finding out the number of
    rows returned from a query before actually getting each row?
    In Forms 4.5 you can use the count_query function, does anyone
    know of an equivalent function or work around in JDBC and/or
    SQLJ?
    Thanks.
    null

    Pasi Hmlinen (guest) wrote:
    : Try
    : SELECT COUNT(*) FROM the_table WHERE <conditions>;
    : Hope this helps,
    : Pasi
    Thanks for the advice, I'm currently using SELECT COUNT(*) but
    I'm looking for a more efficient way of doing it. If I SELECT
    COUNT each time then I have to prepare and execute a SQL
    statement each time. What I want to do it execute a single SQL
    statement to return my results and somehow find out the number
    of rows in the resultset without having to go back to the
    database.
    Gethin.
    null

  • How do i count the rows??

    hello,
    i have a database from where I import a table.
    now, because of my data-structure i need to know the nubmers of row in my table.
    For that i don't want to use the sql-statement: select count(*) ....
    but instead I want to use a java JDBC function. I looked at the docu, but i wasn't able to find it.
    Can somebody help me please?
    thanks
    Markus

    i have a database from where I import a table.
    now, because of my data-structure i need to know the
    nubmers of row in my table.Using an array perhaps?
    Why not use an ArrayList and simply add
    each record as you fetch it -- then you don't
    need foreknowledge of how many you fetched.
    For that i don't want to use the sql-statement: select
    count(*) ....
    but instead I want to use a java JDBC function. I
    looked at the docu, but i wasn't able to find it.
    Can somebody help me please?
    ResultSet rset = ...
    int iRowCount=0;
    if (rset.next())
      rset.last();
      iRowCount = rset.getRow();
      rset.first();

  • Sorting the Rows in a JTable Component Based on a Column

    Hi Masters..would like to have your valuable help and suggestion..i am using jdk1.4.i have jtbale and would like to have one column data in sorted way...
    just i am enclosing my code in tha i am using Collections.sort(data, new ColumnSorter(colIndex, ascending)); but that compare of that comparator is not at woring that data is not getting soretd.
    here data is the jtable complete data.
    Main java file:
    package com.ibm.sort;
    import java.awt.Dimension;
    import java.awt.GridLayout;
    import java.util.Arrays;
    import java.util.Collections;
    import java.util.Comparator;
    import java.util.Vector;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableModel;
    public class SimpleTableDemo extends JPanel {
    private boolean DEBUG = false;
         int colIndex;
              boolean ascending;
         DefaultTableModel model = new DefaultTableModel();
    public SimpleTableDemo() {
    super(new GridLayout(1,0));
    String[] columnNames = {"First Name","Last Name","Sport","# of Years","Vegetarian"};
    Object[][] data = {
    {"Mary", "Campione","Snowboarding", new Integer(5), new Boolean(false)},
    {"Alison", "Huml", "Rowing", new Integer(3), new Boolean(true)},
    {"Kathy", "Walrath","Knitting", new Integer(2), new Boolean(false)},
    {"Sharon", "Zakhour","Speed reading", new Integer(20), new Boolean(true)},
    {"Philip", "Milne", "Pool", new Integer(10), new Boolean(false)}
    final JTable table = new JTable(data, columnNames);
    table.setPreferredScrollableViewportSize(new Dimension(500, 80));
              table.setAutoCreateColumnsFromModel(false);
         JScrollPane scrollPane = new JScrollPane(table);
    add(scrollPane);
              sortAllRowsBy(model, 1, true);
         public void sortAllRowsBy(DefaultTableModel model, int colIndex, boolean ascending) {
                   Vector data = model.getDataVector();
                   System.out.println("SimpleTableDemo.sortAllRowsBy()11111");
                   Collections.sort(data, new ColumnSorter(colIndex, ascending));
              //Collections.sort(data);
                   //Arrays.sort(data, new ColumnSorter(colIndex, ascending));
                   System.out.println("SimpleTableDemo.sortAllRowsBy()2222");
                   model.fireTableStructureChanged();
    * Create the GUI and show it. For thread safety,
    * this method should be invoked from the
    * event-dispatching thread.
    private static void createAndShowGUI() {
    //Create and set up the window.
    JFrame frame = new JFrame("SimpleTableDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Create and set up the content pane.
    SimpleTableDemo newContentPane = new SimpleTableDemo();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);
    //Display the window.
    frame.pack();
    frame.setVisible(true);
    public static void main(String[] args) {
    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    Second FIle which has sorting :
    * Created on Jun 21, 2008
    * To change the template for this generated file go to
    * Window>Preferences>Java>Code Generation>Code and Comments
    package com.ibm.sort;
    import java.util.Comparator;
    import java.util.Vector;
    // This comparator is used to sort vectors of data
    public class ColumnSorter implements Comparator {
         int colIndex;
         boolean ascending;
         ColumnSorter(int colIndex, boolean ascending) {
              System.out.println("ColumnSorter.ColumnSorter(---colIndex--:"+colIndex+" ,ascending: "+ascending);
              this.colIndex = colIndex;
              this.ascending = ascending;
              System.out.println("ColumnSorter.ColumnSorter()");
         public int compare(Object a, Object b) {
              System.out.println("compare-----:");
              Vector v1 = (Vector)a;
              Vector v2 = (Vector)b;
              Object o1 = v1.get(colIndex);
              Object o2 = v2.get(colIndex);
    System.out.println("ColumnSorter.compare(): -o1- :"+o1+" ,o2: "+o2);
              // Treat empty strains like nulls
              if (o1 instanceof String && ((String)o1).length() == 0) {
                   o1 = null;
              if (o2 instanceof String && ((String)o2).length() == 0) {
                   o2 = null;
              // Sort nulls so they appear last, regardless
              // of sort order
              if (o1 == null && o2 == null) {
                   return 0;
              } else if (o1 == null) {
                   return 1;
              } else if (o2 == null) {
                   return -1;
              } else if (o1 instanceof Comparable) {
                   if (ascending) {
                        System.out.println("ascending-->ColumnSorter.compare()-((Comparable)o1).compareTo(o2): "+(((Comparable)o1).compareTo(o2)));
                        return ((Comparable)o1).compareTo(o2);
                   } else {
                        System.out.println("Desending-->ColumnSorter.compare()-((Comparable)o1).compareTo(o2): "+(((Comparable)o1).compareTo(o2)));
                        return ((Comparable)o2).compareTo(o1);
              } else {
                   if (ascending) {
                        System.out.println("ColumnSorter.compare()---o1.toString().compareTo(o2.toString())---: "+(o1.toString().compareTo(o2.toString())));
                        return o1.toString().compareTo(o2.toString());
                   } else {
                        return o2.toString().compareTo(o1.toString());
    Please help is deadly needed.
    thanks in advance!!!

    Learn to use code tags.
    Learn to use google.
    http://www.google.com/search?q=java+sort+rows+jtable&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

  • Counting the rows in a ResultSet

    I am wondering how I could find out the number of rows in a ResultSet after performing a query?

    In case anyone's curious I figured out the problem. The ResultSet needs to be set to move forward AND backward. This is done as follows:
    Statement stmt = conn.createStatement(
                             ResultSet.TYPE_SCROLL_INSENSITIVE,
                                  ResultSet.CONCUR_READ_ONLY);

  • Empty Line at the End of a List Component

    I am using a list compenent in which I am manually adding
    items to it (i.e. addItemAt). The list is long enough to be
    scrollable. At the end of the list is a blank line, or a space big
    enough to look like the size of a line. It is not clickable or you
    can't highlight it if you click but it is there and looks a little
    funny.
    Does anyone know what is creating this and how to get rid of
    it?
    Thank you.
    Dave

    Pretty much you are creating this... Are you iterating an
    array to populate
    the list, and not stopping soon enough? Remember arrays are 0
    index based,
    you you want to go to < the length, not <= the length.
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Count the rows which differes a column value

    msg deleted
    Edited by: user11253970 on Jul 14, 2009 11:33 AM

    Perhaps this
    with a as (
         SELECT cert_no, count(distinct RACE_CODE) RACE_CODES   FROM subscriber
         group by cert_no having count(distinct RACE_CODE) > 0 )
    b as (  
         SELECT cert_no, count(distinct RACE_CODE) RACE_CODES FROM med_subscriber
         group by cert_no having count(distinct RACE_CODE) > 0 )
    c as (
         select cert_no, count(distinct RACE_CODE) RACE_CODES from den_subscriber
         group by cert_no having count(distinct RACE_CODE) > 0 )
    select  cert_no, a.race_codes + b.race_codes||' (in med_subscriber and subscriber tables)'
            ||' , '||  c.race_codes ||' (in den_subscriber table).'  col1
    from a , b ,  c
    where a.cert_no = b.cert_no
    and a.cert_no = c.cert_no
      note: not tested for your data.
    SS

  • Count the number of rows based on the values!!!

    Hi all,
    What I am using:
    I am working with a multidimensional database in Visual Studio 2010 using its Data source view and calculation member and dimension usage.
    What I want to do:
    I have a fact table that has five columns(leg(s),hand(s), Head and body,overall) that shows the category of how severe the injury is. Let say for the records all columns never have an empty value(no injury is stated with 'No injury' ) . These five columns
    are connected with a dimension that has all the available values (Category A-E of injury).The overall has the most severe from the other four columns. I want to create a bar chart with five different measure
    values, one for each column, and count the values in those columns. 
    For example : I have a slicer in the excel and a bar chart and the slicer has all the values of the Category of the injury ( Cat a,Cat B, Cat C, ... Cat E, No injury ) and when i select one of them, lets say
    Cat C,  the bar chart should update and show how many Cat C each measurement column has. 
    Example FACT table:
    ID      LEG      HAND    HEAD   BODY OVERALL
    1        No         A           No        No        A
    2        No        D            C          C         C
    3    E         C            D           A         A
    4         E          E           B            C         B
    So if i selected C the bar chart will count   (Leg = 0, Hand = 1, Head = 1, body = 2 and Overall = 1).
    Any ideas ?
    Thanks for the help and the time :) 

    Hi DBtheoN,
    According to your description, you want to create a chart on excel worksheet to count the rows based on the value, right? If in this case, I am afraid this issue is related to Office forum, I am not the expert of Office, you can post the issue on the corresponding
    forum.
    However, this requirement can be done easily on SQL Server Reporting Services. You can using the expression below to count the rows.
    =COUNT(IIF(Fields!LEG.Value=Parameters!TYPE.Value,1,NOTHING))
    Regards,
    Charlie Liao
    TechNet Community Support

  • Count the displayed date rows on a column.

    Hi,
    I am trying to have a table with the following information and try to give a total count (of the dates visible) at the bottom of the table for the date columns. (not counting the rows)
    (E.g.- Under the Sent column there are 5 dates displayed and there are 6 numbers associated. On the received column there are 3 dates displayed for 6 numbers)
    Could you please advice me how to accomplish this. Thank you in advance.
    Rob.
    Name SENum SentReceived
    John      1234     12/22/06     
         5678     12/13/06     
         6565     12/19/06     1/6/07
         5656 - -
    Jane     9866 12/18/06     1/5/07
    Jim     5657 12/18/06 12/14/06           
    Total:           5      3

    I ma not sue what you want but
    here is some idea at sql plus
    SQL> compute count of ename on deptno
    SQL> compute count of sal on deptno
    SQL> select deptno,ename,sal from emp order by deptno
      2  ;
        DEPTNO ENAME                                                     SAL
            10 CLARK                                                    2450
               KING                                                     5000
               MILLER                                                   1300
    count                                                       3          3
            20 SMITH                                                     880
               ADAMS                                                    1100
               FORD                                                     3000
               SCOTT                                                    3000
               JONES                                                    2975
    count                                                       5          5
            30 ALLEN                                                    1600
               BLAKE                                                    2850
               MARTIN                                                   1250
               JAMES                                                    1045
               TURNER                                                   1500
               WARD                                                     1250
    count                                                       6          6
               DEV                                                      5000
    count                                                       1          1

  • Count MySQL rows based off Value in Dynamic Table

    Greetings all. I have 2 MySQL tables; 1 that contains the names of my classes.(Class A, Class, B, etc.) and 1 table that contains the names of students in each Class (for example Class A: John Doe; Class A: Susie Smith.; Class B: Jane Doe). In the 2nd table the Class name is in its own column and the student's name is in a 2nd column.
    I currently have a dynamic repeating table that lists the names of all of the classes from the 1st table. What I'm trying to do is add a second column to this repeating dynamic table that lists the number of students in each class. For example; Row 1 of the dynamic table would say "Class A | 5; Class B | 3; Class C | 7, etc.). The dynamic table works perfectly to list the class names. For the life of me I can't figure out how to perform a count for each class to insert in the repeating table. I will be adding more Classes which as why I'm trying to set up the counting query dynamically. So far I have only been able to figure out how to count the total rows in the 2nd table, or count the rows with a specified class name. Any advice or guidance on how to count the number of rows in the 2nd MySQL table based off the class name in the repeating table is much appreciated. Thank you for any and all help. Have a great day.

    Select count(*), Class from MyTable
    Group by Class
    Time to learn about SQL:
    http://www.w3schools.com/sql/sql_intro.asp

  • Count all rows of a Database table

    I want to count all the rows of a table.
    I have made correctly the connection with the database and all the other things (make a statement, make the query and the resultSet), I use the MySQL server v4.0.17
    Here is the code I use:
    int count=0;
    String temp=null;
    String query = "SELECT COUNT(*) FROM customers";//customers is my Database Table
    try {
    rs = stmt.executeQuery(query);
    }//end try
    catch(Exception exc) {
    createFeatures.PlayErrorSound(registerRenter);
    Optionpane.showMessageDialog(registerRenter,
    "MESSAGE", "ERROR", JOptionPane.ERROR_MESSAGE);
    }//end catch
    try {
    while(rs.next()) {
    count++; //I use this variable in order to count the rows because the resultSet doesn't tell me the answer
    countLine=rs.getInt(1);
    }//end while
    }//end try
    catch(Exception exc) {
    createFeatures.PlayErrorSound(registerRenter);
    Optionpane.showMessageDialog(registerRenter,
    "MESSAGE", "ERROR", JOptionPane.ERROR_MESSAGE);
    }//end catch
    count=count++; //i increase it aggain because if the rows are initial 0 i want to make it 1
    temp = String.valueOf(count);//i use this command in order to display the result into a jtextfield
    Any help is appreciated!!!!!

    This program will work just fine against mysql:
    mport java.util.*;
    import java.io.*;
    import java.sql.*;
    public class Test {
    public static void main(String []args) {
    String url= "jdbc:mysql://localhost/adatabase";
    String query = "select count(*) from foo2";
    String createQuery="create table foo2(f1 int)";
    String dropQuery="drop table foo2";
    String insertQuery="insert into foo2 values(1)";
    Properties props = new Properties();
    props.put("user", "auser");
    props.put("password", "xxxxx");
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    System.out.println("Connecting to the msql server");
    Connection con = DriverManager.getConnection(url, props);
    Statement stmt = con.createStatement();
    try {
    stmt.executeUpdate(dropQuery);
    } catch(SQLException e) {}
    stmt.executeUpdate(createQuery);
    stmt.executeUpdate(insertQuery);
    stmt.executeUpdate(insertQuery);
    PreparedStatement pstmt = con.prepareStatement(query);
    System.out.println("***Executing a select");
    ResultSet rs = pstmt.executeQuery();
    while (rs.next()) {
    System.out.println("RowCount="+ rs.getString(1));
    rs.close();
    pstmt.close();
    stmt.close();
    con.close();
    } catch(Exception e) {
    System.out.println(e.getMessage());
    }

  • List Component Links

    I have created AS3 script for loading and parsing an RSS
    feed. I have successfully displayed the "title" node on the stage
    in a List Component with the instance name "blogList". Now I wish
    to use the corresponding "Link" node so that each item in the list
    will open a web page to the link for that story. I have been able
    to get each title to link to the last URL link in the RSS feed. I
    am stumped. Help :)

    Answer from the boys at actionscript.org.
    Works like a charm. The function for click is outside of the
    function blogLoaded and most importantly used the data property on
    the object in order to pass the correct reference.
    var blogLoader:URLLoader = new URLLoader();
    var blogURL:URLRequest = new URLRequest("
    http://www.canada.com/calgaryherald/topstories.rss");
    blogLoader.addEventListener(Event.COMPLETE, blogLoaded);
    blogLoader.load(blogURL);
    var blogXML:XML = new XML();
    blogXML.ignoreWhitespace = true;
    function blogLoaded(evt:Event):void {
    blogXML = XML(blogLoader.data);
    //trace(blogXML);
    for(var item:String in blogXML.channel.item) {
    blogList.addItem({label:blogXML.channel.item[item].title,data:blogXML.channel.item[item]} );
    blogList.addEventListener(MouseEvent.CLICK, blogClick);
    function blogClick(e:MouseEvent):void {
    navigateToURL(new
    URLRequest(e.currentTarget.selectedItem.data.link));

Maybe you are looking for

  • How do I get an iPhone contact to appear in iCloud?

    I have a contact that shows up on my iPhone, but not in my iCloud (viewed from a MacBook).  How do I get the contact to appear in in both? iPhone version 7.1.1 MacBook OS X version 10.9.4

  • Dynamic select list with displaying a description

    Hi, I want to have a select List, my list refer to a lov, and the lov refer to a table contaning 2 columns : code and description, The list must display only the code, but I want having an item beside the list dispaling the description.... I have use

  • Error in tool area iview..

    hi... I already have a portaldesktop assigned to our portal by someone. To find what framework page they have assigned to the portaldesktop, I have gone to masterrule collection and have seen the assigned framework page to our portal. Once I got the

  • Activation server error when authorizing my laptop/adobe ID

    Hi.  Whenever I try to authorize my laptop to my newly-made adobe ID, I always got the message Activation server error code : E ADEPT REQUEST EXPIRED blah blah blah.  Upon reasearching on the net, I stumbled on a blog that says that one of the proble

  • Running windows on a mac with ios6

    what version of windows do I need to instll windows on mac snow/l ios6? i'm thinking about windows xp with sp2 J