Count the occurences of a specific combination of chars

Hi there
I want to count the occurences of a specific combination of characteristic in a query.
Example count the occurences of combination CHAR1 CHAR2 CHAR3
CHAR1 CHAR2 CHAR3 Counter
A     BB     CCC    1
A     BB     CCC    1
A     BB     DDD    1
A     SS     DDD    1
Query Result should be
CHAR3 Count
CCC    1
DDD    2
In the HowTo Paper: Count the occurrences of a
characteristic relative to one or
more other characteristics it is only a solution with one characteristic but not with a combination of chars.
I don't know if this possible, because I think it is necessary to do a expeption aggregation based on several chars.
Anyone an Idea?
Thanks a lot in advance
Joe

Joe,
I think in your case it is the case of multiple characteristics and I think the straight way is to do with exception aggregation.
See the below link
http://help.sap.com/saphelp_nw04/helpdata/en/d2/e0173f5ff48443e10000000a114084/frameset.htm
See the below link for some more discussions using formulas which may help you to arrive a decision.
Count elements in a characteristic
Regs
Gopi.

Similar Messages

  • Count the occurence of a character in a string

    Post Author: halfpat
    CA Forum: Formula
    Hello to everyone,
    I use CR 8,0. Is anyone can tell me if this is possible:
    I have a string "12345-C-1 23456-C-2 34567-C-4", how can I count the occurence of the "C" character in this string ?Is the InStr function can help me to do this ?
    I appreciate any suggestion,
    Thanks.

    Post Author: bettername
    CA Forum: Formula
    How about measuring the length of the string, and subtracting the length of the same string where C is replaced with <nothing>?
    len("12345-C-1 23456-C-2 34567-C-4") - len(replace("12345-C-1 23456-C-2 34567-C-4" , "C", ""))

  • 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.

  • How to count a occurence of a string in file

    import java.util.*;
    import java.io.*;
    class Count
    public static void main(String args[ ] )throws Exception
         FileReader fr=new FileReader("d:\\compfetch\\clean\\first.txt");
         BufferedReader br=new BufferedReader(fr);
         StringBuffer sb=new StringBuffer();
         while((s=br.readLine())!=null)
              sb.append(s);
         s=sb.toString();
    Vector v= new Vector();
         v.addElement("job");
         v.addElement("jobs");
         v.addElement("career");
         v.addElement("careers");
         v.addElement("vacancy");
         v.addElement("vacancies");
         v.addElement("opportunity");
         v.addElement("openings");
         v.addElement("posting");
         v.addElement("postings");
         v.addElement("opportunities");
         v.addElement("placement");
         v.addElement("placements");
         v.addElement("job");
         v.addElement("job");
         Enumeration vEnum=v.elements();
         while(vEnum.hasMoreElements())
              System.out.println(vEnum.nextElement());
    I need to count the occurence of each string given in the vector from the text file.I have the file and the vector.How do i compare the vector and textfile ,so that i can count the occurence of eachString in the vector with the text file.The text file may contain any of the words given in the vector.If found ,a count shld be made for each string .
    regards,
    koel

    Try this code:
    import java.util.*;
    import java.io.*;
    class Count
    public static void main(String args[ ] )throws Exception
         FileReader     fr = new FileReader("c.c");
         BufferedReader br = new BufferedReader(fr);
         StringBuffer   sb = new StringBuffer();
         String         s;
         while((s=br.readLine())!=null)
              sb.append(s);
         s=sb.toString();
         Vector v= new Vector();
         v.addElement("job");
         v.addElement("jobs");
         v.addElement("career");
         v.addElement("careers");
         v.addElement("vacancy");
         v.addElement("vacancies");
         v.addElement("opportunity");
         v.addElement("openings");
         v.addElement("posting");
         v.addElement("postings");
         v.addElement("opportunities");
         v.addElement("placement");
         v.addElement("placements");
         Enumeration vEnum=v.elements();
         while(vEnum.hasMoreElements())
              String l = (String)vEnum.nextElement();
              int    a = 0;
              int    p = s.indexOf(l,a);
              int    c = 0;
              while (p != -1)
                   c = c + 1;
                   a = a + l.length() + p;
                   p = s.indexOf(l,a);
              System.out.println(l+"  "+c);
    }

  • PL/SQL - counting values' occurences in a collection - how to optimize?

    Hi all,
    I'm new here and working currently on my PhD thesis, using Oracle (XE) to do some data manipulation stuff.
    Following is defined:
    TYPE stat_col_type IS TABLE OF INTEGER;
    rows_lens stat_col_type;
    Using MULTISET UNION operations, I get the final rows_lens as a set of values, e.g. {1,2,3,1,1,2,2,2,3,3,3,3,3,3,3,1,1,2,1,1,4,5,6,2,2,2,3,3}.
    What I need is to count the occurences of the unique values :
    value of 1 : 7 occurences
    value of 2 : 8 occurences
    value of 3 : 10 occurences
    value of 4 : 1 occurence
    value of 5 : 1 occurence
    value of 6 : 1 occurence
    Ideally, the result should be a separate collection where the values become indexes (there are numbers, natural, unique and countable) and the number of occurences - their values :
    output_col( value ) := number-of-occurences ;
    Of course, I could just go through all the elements incrementing the counters in the output collection, but surely there must be a most efficient way - probably using POWERMULTISET or some kind of SUBSETS. As haven't been using /developing in/ Oracle for a longer period... it's better to ask :)
    Thanks in advance for your suggestions.
    Regards,
    Bart
    Edited by: user3698166 on 2010-01-16 13:44

    What I need is to count the occurences of the unique values :
    Following is defined:Why don't you define in PLSQL and not in SQL?
    It would be so much easier:
    SQL> create type stat_col_type as table of integer
    Type created.
    SQL> select column_value, count (column_value) cnt
      from table (
              stat_col_type (1,
                              2,
                              3,
                              1,
                              1,
                              2,
                              2,
                              2,
                              3,
                              3,
                              3,
                              3,
                              3,
                              3,
                              3,
                              1,
                              1,
                              2,
                              1,
                              1,
                              4,
                              5,
                              6,
                              2,
                              2,
                              2,
                              3,
                              3
    group by column_value
    order by column_value
    COLUMN_VALUE        CNT
               1          7
               2          8
               3         10
               4          1
               5          1
               6          1
    6 rows selected.
    SQL> drop type stat_col_type
    Type dropped.

  • Count bitpattern occurences in textstrings

    Hi
    I was wondering if there are any way to count the occurences of a bitpattern within a textstring using Java. If ANYONE can help me out with this one I would be eternal grateful.
    For instance. If I have the text in a string named str1, I want to check this for every occurence of 11's or perhaps 00's.

    I suppose so. You can always write "11+" or "00+" etc, to represent two or more contiguous occurrences of ones or zeros respectively.
    If you have your binary data in the form of a String variable you can operate on it as if it were a String. So regex works, but of course you can also write your own code searching for the pattern. It's more of an algorithm problem than a Java one.
    I think that from the java aspect you only need to look at the documentation of class String:http://java.sun.com/javase/6/docs/api/java/lang/String.html, so you can manipulate it according to your needs or see what you can do with the regular expressions.

  • Counting Downloads and hits to specific links using UAG

    I am reading UAG first time, can some body explains in simple words that how/where we will install UAG(i mean it has client and server components or install on a single machine)?  keeping in mind that we have 3 entities i.e user, our organization server
    and paid web resource.
    Also Can/how we count the downloads/hits of specific link/website/resource by users by installing UAG?
    Thanks in Advance. 

    The most likely cause is if the phone was supplied by 3 and has their branded software instead of the standard Nokia software and that that is restricting your access. Was the other phone you tried an equivalent network model?

  • How to count the number of occurences of a character

    hi
    wat command is used to count the number of occurences of a charcter in a line?
    i have to count the number of '.' in a line

    FIND
    Searches for patterns.
    Syntax
    FIND <p> IN [SECTION OFFSET <off> LENGTH <len> OF] <text>
                [IGNORING CASE|RESPECTING CASE]
                [IN BYTE MODE|IN CHARACTER MODE]
                [MATCH OFFSET <o>] [MATCH LENGTH <l>].
    The system searches the field <text> for the pattern <p>. The SECTION OFFSET <off> LENGTH <len> OF addition tells the system to search only from the <off> position in the length <len>. IGNORING CASE or RESPECTING CASE (default) specifies whether the search is to be case-sensitive. In Unicode programs, you must specify whether the statement is a character or byte operation, using the IN BYTE MODE or IN CHARACTER MODE (default) additions. The MATCH OFFSET and MATCH LENGTH additions set the offset of the first occurrence and length of the search string in the fields <p> and <l>.

  • Count the number of occurence in table with toplink

    Hi !
    there is no way to build a query with expressionbuilder or .... to count the number of occurences in my table ?
    i don't want use query " select count(*) from table "
    thanks

    Not sure of the question. Are you looking to get the sql "select count(*) from table" from using the TopLink expression framework or are you getting that SQL already and want something else?
    If you are looking just to get the count from a table/class, you can use a ReportQuery:
    ReportQuery rquery = new ReportQuery(ClassToQueryOn.class);
    rquery.addCount(); //equivalent to count(*);
    session.executeQuery(rquery);
    You can use a report query to return data instead of objects, and use selection criteria just like a normal read query.
    Best Regards,
    Chris

  • Count the number of occurences of a pattern in some files

    Hi,
    I am trying to extract some patterns in files using regex. I can easily extract the patterns using my program. I also wanted to count the number of occurences of the pattern in the files. For that I have written this code:
    int count=0;
              while (m.find())
                 System.out.println("Found Patterns: "+m.group());
                 count++;
           System.out.println(count);  //giving error saying identifier expectedUnfortunately I am getting an error saying identifier expected at the count line. What to do?
    Thanks

    Cheapside-Poultry wrote:
    Move the } down one line so the count is in scope.No, it looks like he just forgot the opening { with the while.                                                                                                                                                                                                                                                                                                                                       

  • 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

  • I need to WAP to count the number of occurences of an alphabet in a string.

    I need to WAP to count the number of occurences of an alphabet in a string.I tried a lot and have surfed a lot regarding this problem.
    I m not the most proficient with java.but this is all i could come up with,and would appreciate some help here.I hope you guys would help me find a solution to this.
    e.g String : abcabrty
    Result should be
    a:2
    b:2
    c:1
    r:1
    t:1
    y:1
    public class chkoccurences
         public static void main(String args[ ])
              String user_Data=args[0];
              int counter=0;     
              try
                   for(int i=0;i<user_Data.length( );i++)
                        for(int j=0;j<user_Data.length( );j++)
                             if(user_Data.charAt(i) == user_Data.charAt(j))
                             counter++;
                        System.out.println(user_Data.charAt(i)+" exists "+counter+" time(s) in the word.");
                   System.out.println(" ");
              catch(ArrayIndexOutOfBoundsException e)
                   System.out.println("Check the array size.");
    }This is the output i get out of the program:
    a exists 2 time(s) in the word.
    b exists 4 time(s) in the word.
    c exists 5 time(s) in the word.
    a exists 7 time(s) in the word.
    b exists 9 time(s) in the word.
    r exists 10 time(s) in the word.
    t exists 11 time(s) in the word.
    y exists 12 time(s) in the word.What i think is i need an array to store the repeated characters because the repeated characters are getting counted again in the loop,if you know what i mean.
    Please, i would appreciate some help here.

    Criticism is welcomed
    public class tests {
         final int min = 10;
         final int max = 35;
         final char[] chars = new char[] {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
                   'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
                   'v', 'w', 'x', 'y', 'z'};
         public static void main(String[] args){
              tests t = new tests();
              String[] strings = new String[] {"aabcze", "att3%a", ""};
              for(String s : strings){
                   System.out.println(t.getAlphaCount(s));
         public String getAlphaCount(String s){
              int[] alphaCount = new int[26];
              int val;
              for(char c : s.toCharArray()){
                   val = Character.getNumericValue(c);
                   if( (val>=min) && (val<=max)){
                        alphaCount[val-min]++;
              StringBuilder result = new StringBuilder();
              for(int i=0; i<alphaCount.length; i++){
                   if(alphaCount[i] > 0){
                        result.append(chars[i] + ":" + alphaCount[i] + ", ");
              if(result.length() != 0){
                   result.delete(result.length()-2, result.length());
              return result.toString();
    }

  • To count the number of occurences of a character

    Hi All,
    Is there a particular function to count the number of occurences of a particular character in a string...?
    Let me know if u know the same.
    Thanx and regards
    Akshat

    A method with a test driver:
    public class a {
         public static void main(String args[]) {
              System.out.println(howmany(args[0],args[1].charAt(0)));
         public static int howmany(String what,char c) {
              String regexp = "" + c;
              String s=null;
              try     {
                   s=what.replaceAll(regexp,"");
              catch (Exception e) {          
                    regexp = "\\" + c;
                   s=what.replaceAll(regexp,"");
              return what.length() - s.length();
    }

  • Counting the Multiple Occurence of a record in the internal Table-Urgent

    Hi,
    I have an internal table with the following values
    a
    a
    a
    b
    b
    b
    c
    c
    I need to print a-2
                         b-3
                         c-2
    How do i accomplish this? i.e.,I need to count the multiple occurence of a field.Any input on this will be of great help.
    Thanks and Regards,
    Pavithra

    Hi,
    Find the piece of code below it can help you:
    data: begin of itab occurs 0,
               field1 type c,
               field2 type i,
            end of itab.
    data: itab2 like table of itab occurs 0 with header line.
    data: count type i.
    start-of-seleciton.
    itab-field1 = a.
    append itab.
    itab-field1 = a.
    append itab.
    itab-field1 = a.
    append itab.
    itab-field1 = b.
    append itab.
    sort itab by field1.
    loop at itab.
      count = count + 1.
    at end of field1.
      clear itab2.
      itab2-field1 = itab-field1.
      itab2-field2 = count.
      append itab2.
    endat.
    endloop.
    Dispaly output table.
    loop at itab2.
      write:/ itab2-field1, itab2-field2.
    endloop.
    Reward the points if it is helpful.

  • Can I create a list which counts the number of documents of a specific metadata type by the folder they are stored within?

    Running SP2013 Foundation. My users interact by uploading documents to personal folders within a document library, selecting the type of document they have uploaded via a lookup column and SP list. I have two levels of view in my library, a top level view
    and an in-folder view which contains the metadata and standard document information like version and modified date etc.
    Currently I am able to count the total number of documents that have been uploaded of a particular document type against my document type list, but I would also like to include folder along with document type to thoroughly track document returns by folder
    name. The desired output being a list with a count of document type uploaded by folder name.
    I have tried creating an associated user column at the top level view and also uploading an associated user and folder name list.
    Is this possible and how would I go about this?
    Many thanks for any assistance

    Hello MJH9J,
    Thank you for your question.
    We are currently looking into this issue and will give you an update as soon as possible.
    Thank you for your understanding and support.
    Best Regards,
    Zhengyu Guo
    Zhengyu Guo
    TechNet Community Support

Maybe you are looking for

  • Can't install Server Essentials because it is not currently available from the Software Update server?

    Hi Guys, I have just purchased Mac OS X Lion Server. When I launch the Server App I am told I need to download additional software but once the App attempts to do so I get this message "Can't install Server Essentials because it is not currently avai

  • Best practices for performance on io and storage.

    I'm building / buying a new server was planning on going virtual. Dual xeon 2620 v3 with 64 GB ram we have about 15 users and 14 remote users. Main server 2008 / 2012 SQL 2nd Server 2008 / 2012 File storage 3rd Server / Terminal Services / Citrix (ma

  • IDoc Package to File using Multi Mapping urjent

    Hi Experts, I have a scenario where PI 7.1 need to receive IDocs in a package and should send three files to target system. I am using multi mapping concept here, where i have created one message mapping, one operation mapping with three interfaces s

  • XDcamEX Files in AE CS6

    Please can someone help me, I am struggling to get XDcamEX files int AE CS6, I have read all info i can find about this issue but none have solved it. I can import the same footage into AECS5.5 on the same machine but not AECS6. I have a registered v

  • I searched and searched (fuzzy logic 4)

    Hello! Right now i was reading for over an hour and i cannot find the right answer about fuzzy logic 4 I used live update to get the most recent drivers for my mobo msi 845 pe max2. (just to be complete I have the HT option in the bios while having a