Counting Rows of a Specific Type

I have the following dataset and I was wondering if someone
could help me out with the following problem:
<data>
<row type="A">item1</row>
<row type="B">item1</row>
<row type="B">item2</row>
<row type="C">item1</row>
<row type="C">item2</row>
<row type="C">item3</row>
</data>
How would I set up the code to get the number of rows in the
data set with the 'type' column being C for example? Any help is
appreciated. Thanks!

quote:
if (ds.getDataWasLoaded())
var rows = ds.getData();
for (var loop = 0; loop < rows.length; loop++)
if (rows[loop]["@type"] == "A")
return rows[loop]["ds_RowID"];
alert("Found " + rows.length + "match(es).");
found somethinig like that @
http://labs.adobe.com/technologies/spry/articles/data_api/apis/dataset.html#dataset
im not a java expert, but its probly somethinig like that, it
would probly get u started, i hope

Similar Messages

  • How do I count objects of a specific type in a Vector? Java 1.3 source.

    How do I count the objects of a specific type in a Vector?

    isInstance may allow too much for your needs as it allows any object which can be typecast to 'type' while you seem to want to limit to objects which are exactly of the type 'type'. In such a case you could do this:
    for (Enumeration e = attachmentTypes.elements(); e.hasMoreElements();)
      Object check = e.nextElement();
      if (check.getClass().equals(type)) {
        counter++;
    }Javadoc of the isInstance() method:
    http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Class.html#isInstance%28java.lang.Object%29
    (I link to the old Javadoc given you mentioned Java 1.3 compatible source)

  • How to check/count whether child records with specific type exist?

    Hi
    We need to create a BIP report based on data from Siebel.
    In Siebel we have two entities:
    Entity <Mandate> = Parent Business Componet
    Entity <Attachment> = Child Business Component
    (An attachment has a specific type attribute (e.g. “contract”, “appendix” and lot of others…)
    Relationship between Mandate and Attachments is 1-m.
    We need to create a BIP report which displays all Mandates records which do not have at least two Attachments child records (there must be one attachment child record with type=”contract’ and another with type “appendix”). How can we check in BIP whether these child records with a specific Attachment type exist? And if not, display the Mandate in a list....
    Many thanks
    Alen

    Thanks for your help
    Well I'm not sure about the syatax I have to use in order to filter on the field *<GAMDocumentType>*
    The structure of the xml we use is as follows:
    <ListOfBipJbAmlMandateAttachmentReport>
    <JbAmlMandate>
    <ListOfJbAmlAttachment>
    <JbAmlAttachment>
                   <AccntFileName>DocumentPage_713328</AccntFileName>
                   <GAMDocumentType>*contract</GAMDocumentType>
                   <MandateId>1-4C79B</MandateId>
                   <Status>Active</Status>
    </JbAmlAttachment>
    I tried <?for-each:JbAmlMandate[count(./JbAmlAttachment[GAMDocumentType='contract']) > 1 and count(./Attachment[type='appendix']) > 1]?>
    But this returns nothing.
    Many thanks for your help
    Saggittarius

  • Counting Rows in a message in BPM

    Hi Experts, i need some knowledge sharing here.
    Anybody can tell me how can we get the numbers of rows in a message by using loop in BPM?
    I was thinking of using Loop and container node. But i still don't get it how can i use the loop condition so that my loop is not looping forever.
    Thank you so much guys....

    "I use the "Count" function in graphical message mapping and count the segments and add these to an unused field in the footer"
    Hi thx for the reply, however, can you explain to me in more detail.
    My scenario is i got a message with structure like this:
    Source Message:
    Header  1..1
        item  1..N
          Type 1..1
    Target Message:L
    Header 1..1
       result 1..1
    Now, i want to count how many are there Type with value is for example 'E' and map it to the target message in node 'result'.  So if there are 2 'Type' with value 'E' therefore the 'result' will filled with number '2'. If there is only 1 'Type' with value 'E' thus the 'result' will be filled with number '1'.
    Do I have to use oneAsMany function?

  • Can i count row from ResultSet ?

    I would like to count row from ResultSet for
    take it into my array object because i must know number of row before create array object.
    Example:
    ResultSet rset = stmt.executeQuery("select * from user ");
    /*i = amount of ResultSet*/
    User[] user = new User;
    int l=0;
    while (rset.next()){
    user[l] = new User();
    user.name = rset.getString(1);
    l++;

    Hi,
    As per my knowledge there is no method by which you can get the count of items in a resultset directly. You will have to loop through the reseltset and set a variable for count. In your specific case I would advise you to use a Vetor instead of an array so that you need not bother about the size.
    ResultSet rset = stmt.executeQuery("select * from user ");
    Vector user = new Vector();
    while (rset.next()){
    user.addElement(rset.getString(1));
    Now you will have a Vector that holds the user info. To retrieve the user info loop through the Vector.
    for (int i; i<user.size(); i++){
    userName = user.elementAt(i);
    Hope I was of some help.
    cheers!!!
    Nish

  • Which SIM card does the iPad mini take? Does it have to be specific type of SIM for the iPad mini?

    Which SIM card does the iPad mini take? Does it have to be specific type of SIM for the iPad mini?

    Welcome to the Support Communities. The answer to your question is available in Apple's website — see the Input/Output section here:
    http://www.apple.com/ipad-mini/specs/

  • How to block accounting by MIRO for specific type of documents.

    Hello
    Is there any possibility to block accounting by MIRO for specific type of document? So you could only account specific type of documents by FBV* or FB*.
    Regards
    Marcin Obukowicz

    Hi,
    You can try to make a validation (OB28) which will check the document type based on transaction code prerequisites.
    Regards,
    Eli

  • How to cast an Object into a specific type (Integer/String) at runtime

    Problem:
    How to cast an Object into a specific type (Integer/String) at runtime, where type is not known at compile time.
    Example:
    public class TestCode {
         public static Object func1()
    Integer i = new Integer(10); //or String str = new String("abc");
    Object temp= i; //or Object temp= str;
    return temp;
         public static void func2(Integer param1)
              //Performing some stuff
         public static void main(String args[])
         Object obj = func1();
    //cast obj into Integer at run time
         func2(Integer);
    Description:
    In example, func1() will be called first which will return an object. Returned object refer to an Integer object or an String object. Now at run time, I want to cast this object to the class its referring to (Integer or String).
    For e.g., if returned object is referring to Integer then cast that object into Integer and call func2() by passing Integer object.

    GDS123 wrote:
    Problem:
    How to cast an Object into a specific type (Integer/String) at runtime, where type is not known at compile time.
    There is only one way to have an object of an unknown type at compile time. That is to create the object's class at runtime using a classloader. Typically a URLClassloader.
    Look into
    Class.ForName(String)

  • Count rows from multiple tables using SQL only

    Hi, I know this has probably been answered before, but I couldn't find the answer anywhere. Please help.
    I'd like count(*) [rows] for all tables in database using SQL only - no PL/SQL
    The result should be something like:
    Table RowCount
    DBA_TABLES 1000
    DBA_USERS 50
    etc.
    Thanks!

    offcource write this script:
    create or replace procedure count_tables (ip_schema VARCHAR2)
    is
    lv_owner VARCHAR2(100);
    lv_table_name VARCHAR2(100);
    lv_sql_statement VARCHAR2(2000);
    lv_count_table NUMBER;
    CURSOR c1 IS
    SELECT owner, table_name
    FROM all_tables
    WHERE owner = ip_schema
    ORDER BY table_name;
    begin
    dbms_output.put_line ('+--------------------------------------------------------------------+');
    dbms_output.put_line ('¦ | | ¦');
    dbms_output.put_line ('¦ Schema Name | Table Name | Number of Rows ¦');
    dbms_output.put_line ('¦ | | ¦');
    dbms_output.put_line ('¦------------------------------------------------------------------¦');
    OPEN c1;
    LOOP
    FETCH c1 INTO lv_owner , lv_table_name;
    EXIT WHEN c1%NOTFOUND;
    lv_sql_statement := 'SELECT count(*) FROM ' || lv_owner || '.' || lv_table_name;
    EXECUTE IMMEDIATE lv_sql_statement INTO lv_count_table;
    IF lv_count_table > 0 THEN
    dbms_output.put_line ('| '||rpad(lv_owner, 14, ' ')||'| '|| rpad(lv_table_name, 32, ' ')||'| '|| rpad(lv_count_table, 16, ' ')||' |');
    -- dbms_output.put_line ('|---------------|---------------------------------|------------------|');
    END IF;
    END LOOP;
    CLOSE c1;
    dbms_output.put_line ('+--------------------------------------------------------------------+');
    exception
    WHEN OTHERS THEN
    dbms_output.put_line ('owner: '||lv_owner||' - table: '||lv_table_name||' - '||sqlerrm);
    end count_tables;
    set serveroutput on size 1000000
    exec count_tables
    drop procedure count_tables;

  • Count rows from several tables

    hello,
    im trying to count row from multiple tables
    for example i need the select statement to produce the following
    table_name count
    table1 5
    table2 6
    table3 3
    i came up with the following script but it counts the number of tables i have
    select object_name, (select count(*) from user_tables where table_name = object_name) from all_objects
    where object_type = 'TABLE'

    Manik wrote:
    May be possible:
    Check this:
    SELECT table_name,
    TO_NUMBER (
    EXTRACTVALUE (
    xmltype (
    DBMS_XMLGEN.getxml ('select count(*) c from ' || table_name)),
    '/ROWSET/ROW/C'))
    COUNT
    FROM (select * from all_tables where table_name in ('TABLE1','TABLE2'))
    WHERE owner = 'SCOTT';Cheers,
    Manik.Awesome Manik... Just too good. Thanks.
    I wish i could have given you the 'Correct' points. ;-)
    Can you please explain the logic in brief? Will be helpful for everybody to understand...

  • SQL Developer 2.1 EA - count rows with filter on a table

    This is a small problem that I came across today while using 2.1 EA. I opened a table and did a filter to narrow down the results of the table. Then when I right clicked on the search results and clicked on 'Count Rows'....I get the count of the rows in the table and not my search results.
    Is this a feature or a bug?
    Thanks,
    Mike

    In EA2, we get both the total and the filtered total, nice.
    Only remark is we don't get a progress indicator anymore, and thus can't cancel a query that might take up hours to finish!
    Please log a bug for this.
    Thanks,
    K.

  • Count rows in an internal table

    Anybody how knows how I can count rows in my internal table?

    Hi,
    Data: lines like sy-tabix.
    DESCRIBE TABLE ITAB LINES LINES.
    where itab is your internal table.
    This will work out.
    Please award sutiable points .
    Regards,
    Irfan

  • How to set Tile count column or count row?

    How to set Tile count column or count row? If not can do, How
    to adjust count row or count column?
    Thx for all idea.

    The Tile container's number of columns and rows is calculated
    based on each child's width and height (or based on tileWidth and
    tileHeight which you can set). If you need more control over the
    layout, use Grid.

  • Is there a specific type of mic to use with Garage Band?

    Hello,
    Recently I purchased a mini-plug microphone from Wal-Mart to record my first podcast. However, after pluggin it in, I was unable to get and levels in GB or iMovie.
    Is there a specific type of microphone that I need to purchase to record podcasts?

    For ease of use I went with a USB microphone. I started with a headset mic combo from logitek. It was Ok, but I thought I needed something better, so I got a Blue Snowball. It worked great. Super sound quality for the price, and I just had to plug it in, and set my pref in Garageband to accept it as the new input device.

  • Count rows that are max timestamp

    Hi,
    I'm trying to run a query that will count only rows that are max timestamp.
    i have a submit table which has dates of submissions, however some application numbers have multiple rows in this table. I need to count only one row per application and it has to be the latest submission data.
    I have tried a subquery and its not working, I'm stuck at this point.
    Thanks for help :)
    example table
    pk app # submit_date
    12 test-1 02222011 13:30
    13 test-2 02232011 09:45
    14 test-1 02232011 09:51
    how do i count rows but based on max timestamp?

    select
    count(s.pk)
    from
    submit s
    where exists (select s1.app#, max(s1.submit_date) from submit s1 group by s1.app#)
    I dont really understand what you are doing there.
    SQL> WITH T
      2       AS (SELECT 12 pk, 'TEST-1' app#, SYSDATE submit_date FROM DUAL
      3           UNION ALL
      4           SELECT 13 pk, 'TEST-2' app#, SYSDATE + 1 submit_date FROM DUAL
      5           UNION ALL
      6           SELECT 14 pk, 'TEST-1' app#, SYSDATE + 2 submit_date FROM DUAL)
      7  SELECT * FROM T;
            PK APP#   SUBMIT_DA
            12 TEST-1 23-FEB-11
            13 TEST-2 24-FEB-11
            14 TEST-1 25-FEB-11
    SQL> WITH T
      2       AS (SELECT 12 pk, 'TEST-1' app#, SYSDATE submit_date FROM DUAL
      3           UNION ALL
      4           SELECT 13 pk, 'TEST-2' app#, SYSDATE + 1 submit_date FROM DUAL
      5           UNION ALL
      6           SELECT 14 pk, 'TEST-1' app#, SYSDATE + 2 submit_date FROM DUAL)
      7  SELECT   pk, app#
      8    FROM   (SELECT pk, app#, ROW_NUMBER () OVER (PARTITION BY app# ORDER BY submit_date DESC) rn
    FROM T)
      9   WHERE   rn = 1;
            PK APP#
            14 TEST-1
            13 TEST-2
    SQL>

Maybe you are looking for

  • RFC to Flat file XSLT mapping

    Hi all, we are working on RFC to Flat file XSLT mapping. RFC Structure RFC Name --Item f1 f2 f3 FLAT File Structure MT_FF --Record f1 f2 f3 Can somebody provide the XSLT code template for the same.....

  • Minidisplay port to thunder bolt

    Hi everybody, I do have an apple cinema display 24" from 2009 with a minidisplay port (male) and I do want to buy a new laptop computer or a Mac Mini. Is there any way to connect my screen to them (they come with thunder bolt port only) or do I have

  • Question mark in object name...

    Please help me! After full database import there are a few triggers, packages are invalid. When I try to recompile them I got ORA-00911, because unfortunately there is ? character in their name... How can I compile them? Please, help me! Thank you in

  • I updated my mac's OS to Yosemite and now my eye drop tool will NOT work inside premiere pro. Can anyone help me fix this issue?

    The eyedropper tool for selecting colors to key out or to fill text will not work inside premiere pro, this error started when I updated my mac os to yosemite.

  • Sorting by groups

    I managed to group my students by phone nbr. But, in these groups I want to sort by name or birthday. As soon as I try to sort by name, I lose my group format. Please help. Thanks e.g. jackson, earl jackson, sandy smith, bob smith, edith