Count the SR's based on Each Contract

hi,
hi i want to count the SR's Based on the each Contract
below the xml
<SrReportVO>
<SrReportVORow>
<Srnumber>40734</Srnumber>
<Customername>Business World</Customername>
<Customerid>4429</Customerid>
<Contract>21983</Contract>
<Count1>1</Count1>
<Contactname>Ms. Amy Miller</Contactname>
<Contactphone>1-800-5558355</Contactphone>
<Srdate>24.10.2009</Srdate>
<Srstatus>Working</Srstatus>
<Sritemname>Sentinel Standard Desktop TPD</Sritemname>
<Actualcustomer>None</Actualcustomer>
<Srseverity>High</Srseverity>
<Srowner>Jackson, Mr. Mike</Srowner>
<Srsummary>test</Srsummary>
<Srincidentaddr>,</Srincidentaddr>
<Cnt>1</Cnt>
<Srmonth>Oct</Srmonth>
<Servicerequesttype>TNT TAC Service Request</Servicerequesttype>
<Contractstatus> </Contractstatus>
<Contractdescription> </Contractdescription>
<Updatedate>2009-10-24 17:53:56.0</Updatedate>
<Installaddress>,,,</Installaddress>
</SrReportVORow>
<SrReportVORow>
<Srnumber>40346</Srnumber>
<Customername>Business World</Customername>
<Customerid>4429</Customerid>
<Contract>21279</Contract>
<Count1>1</Count1>
<Contactname>Ms. Amy Miller</Contactname>
<Contactphone>1-800-5558355</Contactphone>
<Srdate>08.10.2009</Srdate>
<Srstatus>Working</Srstatus>
<Sritemname>Sentinel Standard Desktop TPD</Sritemname>
<Actualcustomer>None</Actualcustomer>
<Srseverity>High</Srseverity>
<Srowner>Stock, Ms. Pat</Srowner>
<Srsummary>test</Srsummary>
<Srincidentaddr>,</Srincidentaddr>
<Cnt>1</Cnt>
<Srmonth>Oct</Srmonth>
<Servicerequesttype>TNT TAC Service Request</Servicerequesttype>
<Contractstatus> </Contractstatus>
<Contractdescription> </Contractdescription>
<Updatedate>2009-10-24 18:11:18.0</Updatedate>
<Installaddress>,,,</Installaddress>
</SrReportVORow>
</SrReportVO>
i have different table for the above xml and i want in table like below
contract count of SR's
<Contract Number> <Count of SR's>
<Contract Number> <Count of SR's>
<Contract Number> <Count of SR's>

the contract is the parameter comes from VO
i have implemented your code its working fine but one thing it also show count of sr by contract with o rows
as
contract count(sr)
1234 1
45454 3
87870 0
7970 0
88787 0
<?for-each-group:/SrReportVO/SrReportVORow;Contract?>
<?Contract?>  <?count(Contract)?>
<?end for-each?>i don't to show the rows with sr as count 0
is that possible

Similar Messages

  • Count the number of lines in  each file in a directory

    Hello,
    I would like to count the number of lines for each file in my directory and subdirectories.
    I wonder how can I count the lines of the specified files?
    Here is the program which is listed the files in the specified directory:
                        String path = "C:/User/Studies/Pracices/src/Pract1";
           String files;
           File folder = new File(path);
           File[] listOfFiles = folder.listFiles();
           for (int i = 0; i < listOfFiles.length; i++)
            if (listOfFiles.isFile())
         files = listOfFiles[i].getName();
         System.out.println(files);

    Ok so one more question.
    Actually my path is pointing to one Directory and like here I can just read from one file that the name of the file should be specified in the path is it possible to help me in that part?
    File f = new File("C:/User/Studies/Practices/src/Pract1/");
    FileReader fr = new FileReader(f);
          BufferedReader br = new BufferedReader(fr);
          String str = br.readLine();
              LineNumberReader ln = new LineNumberReader(br);
              int count = 0;
              while (ln.readLine()!=null)
                  count++;
              System.out.println("no. of lines in the file = " + count);

  • Pls help me to count the no of occurence of each word in the data file

    I want to count the no of occurence of each word the data file..
    anybody help me out to solve this ,,
    I have attached my code hereby...
    import java.io.*;
    import java.util.*;
    import java.util.Collections;
    import javax.print.attribute.standard.Media;
    class WordCounter1 {
    String s;
    String word;
    public static void main (String[] args){
         WordCounter1 simpleCounter= new WordCounter1();
    try
    File firstFile=new File("C:/Documents and Settings/janmala/file4.txt");
    simpleCounter.countWords(firstFile);
    catch(Exception e)
    System.err.println(e);
    void countWords(File inputFile)
    int count=0;
    int key=0;
    LinkedHashMap lhm=new LinkedHashMap();
    try{
    FileInputStream fin=new FileInputStream(inputFile);
    DataInputStream din=new DataInputStream(fin);
    while(din.available()!=0){
    s=din.readLine();
    StringTokenizer st=new StringTokenizer(s);
    while(st.hasMoreTokens())
    word=st.nextToken();
    lhm.put(word,count);
    if(lhm.containsKey(word))
    lhm.get(word);
    count++;
    System.out.println(word);
    System.out.println(count);
    int a=lhm.size();
    System.out.println("The size of Hash map"+a);
    Set set = lhm.entrySet();
    Iterator it = set.iterator();
    while(it.hasNext())
    Map.Entry me = (Map.Entry)it.next();
    System.out.println(me.getValue()+":"+me.getKey());
    catch(Exception e)
    System.err.println(e);
    }}

    jan07 wrote:
    anybody help me out to solve this ,,Solve what?
    Don't just dump a pile of unformatted code and expect someone to magically fix it for you.
    Post code, hightlight it and click the CODE button to retain formatting
    Include error messages if you get them
    Ask an actual question

  • Counting the number of lines for each procedure in a package

    Hi,
    I would like to write a query on USER_SOURCE that can display the number of code lines for each procedure/function in a package.
    Is it possible to write such a query? Maybe by using analytical functions?
    for example in the following example i would like to count the lines between "PROCEDURE proc1 IS" and "END proc1;" and between "PROCEDURE proc2 IS" and "END proc2;"
    SQL> select text  from user_source where name='PKG_TEST' and type='PACKAGE BODY';
    TEXT
    PACKAGE BODY PKG_TEST IS
      PROCEDURE proc1 IS
      BEGIN
        update t1 set EDITION_NAME = 'AAAAAAA';
        commit;
      END proc1;
    PROCEDURE proc2 IS
      BEGIN
       update t1 set EDITION_NAME = 'AAAAAAA';
        commit;
      END proc2;
    END PKG_TEST;thanks for helping

    onedbguru wrote:
    Hopefully some idiot manager isn't trying to use this sort of thing to base their decisions on developer productivity. If so, they ARE idiots. Number of code lines NEVER, EVER, EVER!!! translates into an efficient application. If I were paid by the line, my code would look like:
    select
    1
    from
    dual
    Based on the idiocy of this method of determining "performance" I would get paid $5.00 at $1.00/line. And trust me, I saw this back in the 80's and 90's and saw similar idiotic code and had to clean up the mess. Most of it wasn't efficient code to start with let alone the number of lines generated.Or the other extreme, when the PHB firmly believed that execution efficiency was gained by reducing the number of lines of code. So instead of nicely formatted, easy to read code:
          *GET NEXT ORDER NUMBER                                                               
                EXEC SQL                                                                        
                     SELECT (MAX(ORDER_NUM) + 1)                                                
                     INTO   :NEXT-NUM:IND-NULL                                                  
                     FROM   PART_ORDER                                                          
                END-EXEC.                                                                       
                IF IND-NULL < 0                                                                 
                  MOVE 1 TO NEXT-NUM.                                                           
                EXEC SQL                                                                        
                     INSERT                                                                     
                     INTO    PART_ORDER                                                         
                            (ORDER_NUM,                                                         
                             ORIGIN_LOC,                                                        
                             ORDER_TYPE,                                                        
                             ORDER_STAT,                                                        
                             CREAT_TIME)                                                        
                     VALUES (:NEXT-NUM,                                                         
                             :LOC, 'R', 'O',                                                    
                             CURRENT TIMESTAMP)                                                 
                   END-EXEC.                                                                    
                MOVE NEXT-NUM TO MASK0.                                                         
                PERFORM HEADER-PROC THRU HEADER-EXIT.                                           
            CREATE-ORDER-EXIT. EXIT.                                                     You got this:
           *GET NEXT ORDER NUMBER
            EXEC SQL SELECT (MAX(ORDER_NUM) + 1) INTO :NEXT-NUM:IND-NULL FROM
            PART_ORDER END-EXEC. IF IND-NULL < 0 MOVE 1 TO NEXT-NUM. EXEC SQL INSERT
            INTO PART_ORDER (ORDER_NUM, ORIGIN_LOC, ORDER_TYPE, ORDER_STAT,
            CREAT_TIME) VALUES (:NEXT-NUM, :LOC, 'R', 'O', CURRENT TIMESTAMP)
            END-EXEC. MOVE NEXT-NUM TO MASK0. PERFORM HEADER-PROC THRU HEADER-EXIT.
            CREATE-ORDER-EXIT. EXIT.                 Oh, wait! See the same thing all the time in this forum ... not because someone thinks fewer lines = faster code, but simply because people are sloppy.
    INSERT INTO PART_ORDER(ORDER_NUM,ORIGIN_LOC,ORDER_TYPE,ORDER_STAT,CREAT_TIME) VALUES (:NEXT-NUM,:LOC, 'R', 'O',CURRENT TIMESTAMP) ;

  • Count the number of rows in each table

    I have a list of table names, how to I write a query to find out the row count of each table.
    select table_name from all_tables a where owner='XXX' and num_row > 100
    or
    select table_name from all_tables a where owner='XXX' and sample_size > 100
    doesn't quite work.
    Why?
    Thanks in advance,
    Edited by: mpt_fz on Jan 12, 2010 12:06 PM

    Well, then another method learned from Michael ;)
    scott@ORCL>
    scott@ORCL>select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE    11.1.0.6.0      Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    Elapsed: 00:00:00.14
    scott@ORCL>
    scott@ORCL>
    scott@ORCL>select table_name,
      2         DBMS_XMLGEN.getxmltype(
      3                                 'select count(*) c from '||table_name
      4                               ).extract('//text()').getnumberval() tot_rows
      5  from user_tables
      6  where iot_type is null
      7  or iot_type != 'IOT_OVERFLOW';
    TABLE_NAME                       TOT_ROWS
    A_TEST_TB_CASHFLOW                     14
    TEST_DUMMY                              1
    A_TEST_TB_CASHFLOW_N                    1
    TEST_CAST                               1
    DEPT                                    4
    EMP                                    14
    BONUS                                   0
    SALGRADE                                5
    EMP_DETAILS                             3
    T_EMP                                   0
    AUDIT_T                                 0
    TABLE_NAME                       TOT_ROWS
    C_C                                     4
    TRAIN_DET                               2
    TEST_COM_IMP                            2
    TIME_P                                  1
    PRI_UQ                                  4
    TEST_CHK                                0
    ANSHUMANSAHAISGENIOUS                   1
    T                                       1
    XEUROPE                                 2
    D_D                                     8
    PUBLICTRANSPORT                         4
    TABLE_NAME                       TOT_ROWS
    XASIA                                   2
    TF1                                     0
    TEST_HH                                14
    TEST_SWAP                               4
    REVIVE_XML                              3
    XGMT                                    1
    CUSTOMER_DET                            1
    FOURWHEELER                             2
    SPOOL_LOG                              13
    CITYTRANSPORT                           8
    T1                                      2
    TABLE_NAME                       TOT_ROWS
    T2                                      2
    A_A                                     1
    B_B                                     2
    AUTOMOBILE                              1
    XDUAL                                   1
    S_TEMP                                  0
    39 rows selected.
    Elapsed: 00:00:08.78
    scott@ORCL>Regards.
    Satyaki De.

  • Report for counting the number of interfaces in each device

    Hi, we have LMS 4.0.1 and we would like to know how many gigabitEthernet interfaces and how many fastEthernet interfaces does each device have. If we create a custom report template with the conditions "Interface:Type:Contains:Gi" OR "Interface:Type:Contains:Fa" we get the interfaces that match the criteria but we also need the count, and this is what we don't know how to do it.
    Does anyone know how can we do it?

    Hi
    Suppress results rows for number of items..that is 10,20...
    Calculate result rows only for sales order ...1000000...
    You should get intended result with this settings
    Regards
    N Ganesh

  • Dynamic Pie Chart: Counting the number of instances for each value

    Hello my name is Tim and I am at a roadblock concerning a chart for a dashboard design.
    I have a list with two fields:
    Platform and Status. The list is customized in InfoPath. The
    Platform field is located on the form as a drop-down menu with 6 entries.
    Status is a choice field with 3 selection that is updated through the lifespan of the project (once item created, it is updated to "In process", once the project is closed, the field is updated to "closed."
    My hurdle is viewing these dynamically in a Pie Chart. I am  trying to display the number of project's "In process" for each Platform. So, if Platform A has 6 projects "In process" and Platform B has 3 projects "In process"
    how can this be displayed in a pie chart?
    At the moment, I figured there are two options: Chart View WebPart or importing an Excel  worksheet.
    Any ideas or solution on how to accomplish this?
    -Tim Dempsey

    Three options:
    1. Create a list that holds your statuses. Then in your original list, create a lookup to the status list. In your status list, make a lookup to the lookup. This creates a circular reference which, for whatever reason, returns a count. You can then connect
    a chart web part to this. Repeat for the other column.
    2. Go to your sharepoint list and export to spreadsheet. Save the file. This is a query file that you can use as a data connection. From that file, set it to auto-update and then create a chart from a pivot table. Then use Excel Services Web Part to display
    the file.
    3. The other option is to use Google Charts API. Connect to the list, run some jQuery and JavaScript and then export out a chart. Pretty cool tool.
    Andy Wessendorf SharePoint Developer II | Rackspace [email protected]

  • Not able to reset the page number in XML Publisher based on each PO

    Not able to reset the page number in XML Publisher based on PO
    Hi,
    I have created a custom purchase report and rtf template. In the rtf template, I have added the page number feature (i.e. Page 1 of 5) from Word in the template. When I run the report for a range of POs, I expect the results as follows:
    I have given 3 POs on single request. (PO#1 has 3 pages, PO#2 has 2 pages and PO#3 has 4 pages), the page number on each PO should look like as follows:
    PO#1 page 1 of 3, page 2 of 3, page 3 of 3
    PO#2 page 1 of 2 page 2 of 2
    PO#3 page 1 of 4, page 2 of 4, page 3 of 4 and page 4 of 4
    But the page number displays on each PO as follows:
    PO#1 page 1 of 9, page 2 of 9, page 3 of 9
    PO#2 page 4 of 9 page 5 of 9
    PO#3 page 6 of 9, page 7 of 9, page 8 of 9 and page 9 of 9
    Here I have to reset the page number based on each PO. If anyone done this already, can you please share with me.
    Thanks,
    Ram.

    Hi
    One clarification please.
    Are you putting Page # of ## in the for-loop section? I mean it should be within For-each@section block.
    Even if this doesn;t work, then try using Insert->Page Break after every PO.
    Regards
    Varun

  • Custom Exit to count No: of Employee based on User Input Date

    Hi There,
    I have a requirement to Count the no: of Employees for each Position Id. This count value changes with time (Time-dependent).
    So, when the user Keys-in a date at the Query Execution-Prompt, it should take the date value and then count the no: of employees for each Position Id.
    Next, it should display text  like If Count = 1    "Single"
                                                      If Count =2     "Double"
                                                      If Count >=3   "Triple"
    I was informed that we should create a Calculated Key Figure and then introduce a variable in it with Replacement path as Customer Exit.
    My Question is: Could any one provide me the logic to implement the Customer Exit for above requirement. I kow that I need to implement this is BI ABAP editor as Include file.
    Further, I referred following Forums links. However, I need more information.
    counting the number of rows.
    Customer Exit Variable Code
    Any Suggestions!
    - Anil

    Hi,
    As I understood, first thing you may not have text for a key figure (will not be able to display "Single", "Doüble" etc..)
    Are you doing reporting on master data or cube?.
    If it is a master data the it will be better to include count at staging level. You just need to include one key figure count as an attribute and assign 1 over there. You may usee this key figure directly in report.
    If it is one cube/DSO then just create one CKF assign value as 1 in report in that. Use Exception aggrigation for this CKF reffering Position id in report. Dipslay this key figure.
    I hope it will help.
    Thanks,
    S

  • How do I count the number of occurrences of a string within a group of cells?

    Hello all, I'm trying to figure out how to count the number of times a child has completed certain tasks.  Here is a sample of the data (it is highly simplified here, but contains what I hope is needed to answer my question):
    Unnamed Table
    Objective
    John
    Ann
    Alex
    Dave
    Eric
    20a 20b 20c
    x
    20a 20b 20c
    x
    20a 20b 20c
    x
    x
    19b 20a
          x
           x
    20c 21b 22
         x
    What I am trying to do is count the number of times each child completed each objective - but I can't figure out how to go about splicing up the "objectives" fields for counting while still being able to compare them to whether or not the "child" has 'an x in the box' in that particular row.

    If I read your example correctly, John's counts should be 2 for 20a, 1 for 19b, 20b and 20c, and 0 for any other objectives listed.
    Here's an example that will work for your data set, assuming that any objective ma occur only once in each row of column A of the Main table. I've added an a to objective 22, but I think it is unnecessary, provided there is no objective 122, 221, etc.
    This uses a two step process.
    The table AUX extracts the objectives completed by each student, using the checkboxes in Main. Note that it also adds a space at the beginning and end of each string. This provides an extra character before the first objective code and after the last objective code in that row, used by the wildcard specification in the formula in the Summary table.
    Formula:
    Aux::B2: =IF(OFFSET(Data :: $A$1,ROW()-1,COLUMN()-1)," "&OFFSET(Data :: $A$1,ROW()-1,0)&" ","")
    Fill right to the last column and down to the last row of Aux.
    Summary uses COUNTIF to count the number of occurrences of each of the objectives listed in column A of that table.
    Formula:
    Summary::B2: =COUNTIF(Aux :: B,"=*"&$A2&"*")
    Fill right and down as the previous formula.
    Regards,
    Barry

  • Count the number of elements in an Arraylist

    My arraylist has these elements inside it.
    [house,tom:, agent,, person,, untidy,jack:, ordered,, tidy,, tiled,roof,tom:, agent,, person,,.....]. The list continues like this.
    How can I count the number of elements after each tom upto before each jack and same for all words after jack and upto before tom? [for example in the first case there are 3 words after tom and there are 4 words after jack.]
    Thanks

    don't collapse your lists together. They represent separate data entities and should be kept separate. Go check your [other thread|http://forums.sun.com/thread.jspa?threadID=5416414&tstart=0].
    Edited by: DeltaGeek on Nov 17, 2009 11:07 AM

  • Counting the number of occurences in a table column

    Hi All
    I have a table with a column that contains approx. 5000 6-digit codes. A number of these codes are duplicted in the column, and I want to count the number of occurences of each code. The column looks a bit like -
    WCID
    940042
    920012
    940652
    940199
    188949
    155146
    155196
    174196
    152148
    151281
    196209
    174015
    182163
    195465
    195318
    182008
    189589
    150675
    There can be mulitple instances of each WCID and I need to count the number of instances of each. I also have access to another table that also has a column of each WCID, but only once - ie no multiple instances. The second table is identical except that there are only single instances of each WCID.
    I thought I could either loop through on the table to be counted, from 100000 to 999999 and count each occurence that way, but it would be very inefficient. The other way I thought would be to perhaps select a WCID from the unique table, count the occurence of that, select the next WCID from the unique table, count that and so on, however I'm not sure how to do it in PL/SQL. Perhaps select the WCID from the unique table into a cursor, loop through that and compare it with the original table and count the instances?
    I hope this makes some sense, any help would be really appreciated
    Thanks
    Bill

    Hi, Bill,
    That sounds like a job for GROUP BY:
    SELECT    wcid
    ,         COUNT (*)       AS num_found
    FROM      table_x
    GROUP BY  wcid
    ORDER BY  wcid
    I hope that answers your question.
    If not, post CREATE TABLE and INSERT statements for a little sample data, and the results you want from that data.

  • Count the number of unique values in column

    Hi
    I have a large numbers file (thousands of rows) with data for different dates. I need to calculate the number of unique (distinct) dates are in the spreadsheet.
    Does anyone know how to do this?
    Thanks,
    Bruce

    bpj,
    Let's say your date is in column B for this example and your first data row is Row 2. In another column you can enter into row 2: =IF(COUNTIF($B$2:B2, B)=1, 1, "") Summing the new column content will yield the number if unique dates.
    As badunit observes, this will result in sluggish document. If the number of possible dates is small compared to the number of rows of data, it would be better to make a table of possible dates and count the number of occurrences of each of those dates in the data, a COUNTIF function on the frequency data for the date range will give you the number of unique dates, possible much more efficiently.
    Jerry

  • SSRS- Counting the number of occurrences

    Hi,
    I have table 1 filled with numbers 1-5. I need to count the number of occurrences for each number in table 2.
    For example,
    Table 1
    3
    4
    5
    4
    3
    Table 2 1-- 0 occurrences 
    2-- 0 occurrences
     3-- 2 occurrence
     4-- 2  occurrences
     5-- 1  occurrences
    Can I do this in a SSRS report?
    Thank you in advance!

    Hi Rebecca07,
    After testing the issue in my local environment, we can refer to the steps below to achieve your requirement:
    Drag a table from Toolbox to design surface.
    Delete the detail row (second row) and the third column.
    Right-click the first row to insert five rows after that row.
    Type the following expressions in each cell:
    numbers             occurrences
    1                        =count(iif(Fields!number.Value=1,1,nothing))
    2                        =count(iif(Fields!number.Value=2,1,nothing))
    3                        =count(iif(Fields!number.Value=3,1,nothing))
    4                        =count(iif(Fields!number.Value=4,1,nothing))
    5                        =count(iif(Fields!number.Value=5,1,nothing))
    The following screenshot is for your reference:
    If you have any other questions, please feel free to let me know.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • 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

Maybe you are looking for