Need to count the number of groups in a Crystal Reports 2008 report

I have created a report with three levels of grouping. There are several items in each level.  I want to count the number of groups.  I have tried countdistinct but it counts the number of items in the lowest level of grouping and I want the number of items in the higher  levels.  This is a distribution data base.  I have the data grouped by date, by truck on each date, and by "run" or load on each truck on each date.  I want to count the total number of groups of truck and run, which is the second level of the grouping.  Any ideas? I am fairly new to Crystal.

Hi Debbie,
     To count the number of groups please try the folling steps:
1) Create a formula @reset and place this formula in the page header
    whileprintingrecords;
    numbervar i:=0;
2) Create another formula @evalgroup place this in the group header where you want to count the values.
    whileprintingrecords;
    numbervar i:= i+1;
3) Create another formula @display and place this in report footer.
    whileprintingrecords;
    numbervar i;
In order to display the count of details which are printing in the detail section place the eval formula in the detail section and the @display formula in the group footer.
Hope this helps!!!
Regards,
Vinay

Similar Messages

  • Need to count the number of times the Basic Finish data chages

    HI Expertes,
    I have a requirement I need to count number of times the Basic finish date chaged for PM work order. I went throug our forums I got some info like using a standard function module
    CHANGEDOCUMENT_READ_HDRS_ONLY
    CHANGEDOCUMENT_READ_HEADERS
    CHANGEDOCUMENT_READ_POSITIONS
    But all the above function module will not be suitable for my requirement since  CHANGEDOCUMENT_READ_HDRS_ONLY it gives whole changes but my requirement is just need number of changes occurred in Basic Finish date but CHANGEDOCUMENT_READ_POSITIONS can give the filed number which has been changed but still I need change id.
    So kindly suggest me wether there is any other Standard FM to get number of changes occurred in Basic Finish date?
    Thanks,
    Rajesh

    Hi Debbie,
         To count the number of groups please try the folling steps:
    1) Create a formula @reset and place this formula in the page header
        whileprintingrecords;
        numbervar i:=0;
    2) Create another formula @evalgroup place this in the group header where you want to count the values.
        whileprintingrecords;
        numbervar i:= i+1;
    3) Create another formula @display and place this in report footer.
        whileprintingrecords;
        numbervar i;
    In order to display the count of details which are printing in the detail section place the eval formula in the detail section and the @display formula in the group footer.
    Hope this helps!!!
    Regards,
    Vinay

  • CR 8.5, I need to count the number ordered and the number on back order

    - - Crystal Reports 8.5 - -
    I have two fields.
    Qty Shipped and Qty Backordered.
    I want to calculate the percentage of orders shipped.
    Something like:
    Count ({CIT_PT_RO_Fulfillment;1.QtyShip}) > 0
    Count ({CIT_PT_RO_Fulfillment;1.QtyBackorder}) > 0
    But I know these aren't correct as they return the value of True...
    Then I'll take those two fields and calculate the percentage shipped...
    Can someone help me with this?
    Thanks
    Kelvin

    Hi Kelvin,
    Try this.
    Add the count of field1 with field 2, you will get total number of orders.
    Then you can write below formula to calculate the percent.
    number ordered / total number of orders * 100.
    Hope it helps.
    Thanks,
    Sumit Kanhe

  • (Repost) CR 8.5 I need to count the number or records 0

    - - Crystal Reports 8.5 - -
    I have two fields.
    Qty Shipped and Qty Backordered.
    I want to calculate the percentage of orders shipped.
    Something like:
    Count ({CIT_PT_RO_Fulfillment;1.QtyShip}) > 0
    Count ({CIT_PT_RO_Fulfillment;1.QtyBackorder}) > 0
    But I know these aren't correct as they return the value of True...
    Then I'll take those two fields and calculate the percentage shipped...
    Can someone help me with this?
    Thanks
    Kelvin

    Try this
    if count({CIT_PT_RO_Fulfillment;1.QtyShip})>0 then
    ((Count ({CIT_PT_RO_Fulfillment;1.QtyShip})-Count ({CIT_PT_RO_Fulfillment;1.QtyBackorder}))/Count ({CIT_PT_RO_Fulfillment;1.QtyShip})*100
    Regards,
    Raghavendra

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

  • Counting the number of IDocs in a package of IDocs in BPM

    Hello All,
        I need a solution where I need to count the number of EDI_DC40  segments (The IDoc Count) in a package of IDoc's. The following is the scenario
    1) We are receiving a package of IDoc's in receive step using the XI File Adapter. I was wondering if there is a way that I can count the number of IDoc's in the BPM using a container operation or some other Method. I appreciate any help.
    Thanks.

    HI,
    We have two ooptions,
    one as explained above , yu can use standard count function and that can be used.
    Second one is we have count option in file adapter to count the msgs.
    see the below link
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/0b/9a50465ccf84479e39a6d50c90fb3f/content.htm
    Regards
    Chilla

  • How do I count the number of *'s in a string?

    I need to count the number of * in a string of carakters. And the return the number. 0 for no *'s in the string 2 for two *'s in the string and so on.
    It's probably quite simple but I can't figure out how!

    Like this.
    james_t_dk wrote in message
    news:[email protected]..
    > I need to count the number of * in a string of carakters. And the
    > return the number. 0 for no *'s in the string 2 for two *'s in the
    > string and so on.
    >
    > It's probably quite simple but I can't figure out how!
    [Attachment Untitled 10.vi, see below]
    Attachments:
    Untitled_10.vi ‏18 KB

  • Count the number of comments in a PDF file automatically?

    Hello O Experts,
    My documentation team members use Acrobat and Reader 8, and frequently need to count the number of comments in a PDF file. Is it possible to count the number of comments automatically? We can't find this functionality anywhere, and have to resort to manual counting. Since our PDFs can contain thousands of comments, this is very time-consuming. I've tried searching the Web and these forums, but the words "count" and "comments" are too frequent in other contexts to find anything useful...
    Thanks and best regards,
    --M.T.

    Hi again sypark,
    That is a great idea, and it works!
    I would actually search on a more unique phrase - for instance, "Subject:" - that definitively occurs a single time per comment. The reason is:
    There are many types of comments, not just sticky notes... you have highlights, text deletions, text insertions, replacement text, attachments, callouts, and so on. But each of them has a "Subject:" in the summary.
    It's best to avoid searching for the comment names because they differ by language (an important issue when you work with colleagues in multiple countries). For example, the name of the "Highlight" comment type in French is "Texte surligné" - so you'd have to search for the latter term to get an accurate count.
    In any case, your method is flexible and allows for easy customization of comment counts. Many thanks for your effective help!
    Cheers,
    --Michael

  • Count the number of lines in a txt file

    I need to count the number of lines in a txt file, but I can't do it using readLine(). This is because the txt file is double spaced. readLine() returns null even if it is not the end of the file. thanks for the help

    I need to count the number of lines in a txt file,
    but I can't do it using readLine(). Then just compare each single byte or char to the newline (code 10).
    This is because the txt file is double spaced. readLine() returns
    null even if it is not the end of the file.Errm what? What do you mean by "double spaced"? Method readLine() should only return null if there's nothing more to read.

  • Count the number of times a character is in a string using pl/sql

    I need to count the number of times ":" appers in the string ":XXX:CCC:BBB:".
    I have sound some solution using SQL but I do not want the context switch.
    Also I am on 10g so I can not use REGEXP_COUNT.
    Any help would be great.

    Hi,
    length(REGEXP_REPLACE(':XXX:CCC:BBB:','[[:alnum:]]'))counts all kinds of punctuation, spaces, etc., not just colons. Change any (or all) of the colons to periods and it will still return 4. Use '[^:]' instead of '[[:alnum:]]' if you really want to count just colons.
    Also, "SELECT ... FROM dual" is usually needed only in SQL*Plus or similar front end tools. In PL/SQL, you can call functions without a query, like this:
    x := NVL (LENGTH (REGEXP_REPLACE (txt, '[^:]')), 0);

  • Count the number of records between two key values (BTREE)

    How can I count the number of keys between two values?
    I'm using python driver, and BTREE access method.
    ====>
    ideally what I want is to average a whole time-series data set (the intervals can change) to a given number of points. The keys are the time stamps and the values are the data that needs to be averaged. I need to count the number of records between two time stamps so that I can divide that number by the number of points i need, and average the data. What is the best way to do this?  Or should I just keep the intervals for the time stamp constant and use RECNO access method?
    Thank you
    (first post btw.. and why aren't there many people in stackoverflow who answer Berkeley DB questions?)

    BDB is an embedded db and it does not have any internal counters or statistics that you could grap to use for this.    You will need to do it manually.
    You can create a cursor, grap the records you want, each time you get the next record you bump a counter.
    If you are using RECNO, you can use a cursor to get the record number of the record (DB_GET_RECNO), and if all you data is in
    sequentail records with no missing records you can figure out the total count by take last rec # - initial rec # + 1 to get a total count.
    If you switch over to the SQL API, you can issue a SQL query to give you a count.  Select count(*) Where .......
    Since you have to grab the data anyway, then best may be to count records as you go along.
    thanks
    mike

  • Count the number of values selected in a form

    Hello
    I need to count the number of values selected in a form.
    Here is my form dump:
    I want to count the values circled in red.
    So the number I want in this case is 5.
    Any suggestions?

    Aegis,
    Yeah, good point.  Here is a minor tweak:
    <cfset total = 0>
    <cfloop collection="#FORM#" item="field">
         <cfif field NOT IS "fieldnames">
           <cfset total += ListLen( FORM[ field ] )>
         </cfif>
    </cfloop>
    <cfoutput>
         <p>Total: #total#</p>
    </cfoutput>
    -Carl V.

  • Workflow to count the number of items in a list

    Hello Friends,
    I've a requirement, I need to count the number documents uploaded for a particular list item (identified by a unique Title) and if the count matches with the count stored in another list for that particular list item, bingo......I will update the status
    field to completed.
    Can anybody please help me with this. How do I do this ? Is it possible even ?
    Thank you very much in advance. :)

    Hi,
    I haven't tried this but i think you can achieve it by
    1. Add an Call HTTP activity in your workflow and make a REST call get items
    2. Use Count Items in (Dictionary variable)to get the Items counts of attachment.
    3. Then, lookup for your another list in match item count.
    Your REST query can be similar to this
    url: http://site url/_api/web/lists/getbytitle('list title')/items(item id)/AttachmentFiles/To make Rest call in SharePoint designer https://sergeluca.wordpress.com/2013/04/09/calling-the-sharepoint-2013-rest-api-from-a-sharepoint-designer-workflow/
    https://msdn.microsoft.com/en-us/library/office/dn567558%28v=office.15%29.aspx

  • How to count the number of test ABAP Unit test methods

    I need to count the number of test methods of a class.   Has anybody done this before?   For example, if I have a class that has 3 methods and I wrote 6 abap unit test methods for it.   I can count the number of methods using cl_abap_classdescr=>describe_by_name (which gave me 3 from my example) but I could not find the function module to count the number of test methods (which should give me 6 in my example).
    I appreciate your reply.

    This call does thew trick.  I just had to make sure the prog name that I pass has "CP" from the 30th pos for it return the result.   Here is thew subroutine that I use:
    form get_test_method_count using     query_class
                               changing  test_method_count.
      data: l_progname type progname.
      l_progname = query_class.
      l_progname+30 = 'CP'.  "needed so the following method will recognize this as a class
      data: l_result type if_aunit_prog_info_types=>ty_t_testclasses.
      try.
          call method cl_aunit_prog_info=>get_tests_of_program
            exporting
              progname = l_progname
            receiving
              result   = l_result.
          if l_result is not initial.
            data: result_rec like line of l_result.
            loop at l_result into result_rec.
              test_method_count = lines( result_rec-methods ).
            endloop.
          endif.
        catch cx_root.
      endtry.
    endform.

  • 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

Maybe you are looking for