How to return "Final Row Count" - where I have suppression filters etc

I am building a data interface that outputs "trade records"
Each report/file has a primary header record
each report/file has a secondary header record for EACH TRADE
each report/file has trade details per account under the secondary header record for EACH TRADE
each report/file has a primary footer record, that shows the total row count of the resultant details
the "Records" count in crystal is not what I need, as when the report prints/Exports, certain of those records are suppressed.
I only need what "lands" in my txt file in respect to that final number of total rows of data
Any suggestions are very greatly appreciated.  My search thru the forum did not return an answer that I could see.
thank  you!
Chris
Edited by: CHRISTOPHER MAINARD on Jul 27, 2010 5:14 PM

Thank  you  - I very much appreciate your response - but about the same time you posted - my experimentation and borrowing of like situation formulae seemed to solve it with some tweaking! 
first I added this formula to count each "trade record"
Whileprintingrecords;
numbervar linecnt := linecnt +1
then, in the "file footer" added this:
tonumber({@totalRowCount})DistinctCount ({MoxyAllocation.OrderID})1
thank you again for your input, I'm betting I'll find a use for that in the near future.
CBM

Similar Messages

  • How to get  visible row  count  in JTable ?

    I have one table which is added to one scroll pane. For example my table have total 1000 rows, but at a time only 20 rows should be visible to the scroll pane. And I want to scroll the rows and show only 20 at a time.When user scrolls JTable then next time he can view only 1 to 21, then 2 to 22, and so on. I want to know how to get that number which represents the visible row( in this case it is 20).So kindly help me how to get visible row count. Any help regarding this will be appriciated.
    Thanks and Regards,
    Sheetal

    how to get visible row count.First you need to get the viewport used by the scrollpane. Then you can use methods like getViewPosition() and getViewSize() to get information about the current postition of and size of the viewport.
    Then you can use the table method getRowAtPoint(). to determine the first and last visible row which can then be used to calculate the visible row count.
    When user scrolls JTable then next time he can view only 1 to 21, then 2 to 22, and so onThis is the default behaviour when a "block" scroll is done.
    However when you click on the arrow button on the scrollbar it will only scroll a single row. You could override the getScrollableUnitIncrement() method to return the value from the getScrollableBlockIncrement() method.
    However the user can still drag the scrollbar manually which would cause a problem. So you would also need to remove the MouseMotionListeners from the scrollbar to prevent this.

  • How to get the row Count of a ResultSet

    How to get the row Count of a ResultSet

    Hi
    I'v tried rennie1's way ,but I only get zero,my code is:
    rs.executeQuery("select count(*) from t_test");
    if (rs.next()) int rowCount=rs.getInt(1);
    I also tried barni's way ,but the method rs.last() and rs.beforeFirst() throw a same Exception
    I tried another way,the code is:
    while rs.next(){
    // Do nothing ,just move the cursour to the last row
    int rowCount=rs.getRow()
    However,the rowCount still equal zero
    Any help would be greatly apprecite!
    note:
    I get connection by DataSource's JNDI name from client, the Server is Weblogic Server 6, the DBMS is Oracle.

  • How to add the Row count(number of rows in table)  in  the table header?

    Hi,
    I'm having a table. This table is viewed when i click on a search button.
    <b>On the table header it should dynamically display the number of rows in the table, i.e., the row count.</b>
    How to do this? could any one explain me with the detailed procedure to achieve this.
    Thanks & Regards,
    Suresh

    If you want to show a localized text in the table header, you should use the <b>Message Pool</b> to create a (parameterized) message "tableHeaderText" like "There are table entries".
    Next, create a context attribute "tableHeaderText" of type "string" and bind the "text" property of the table header Caption UI element to this attribute.
    Whenever the table data has changed (e.g. at the end of the supply function for the table's data source node), update the header text:
    int numRows = wdContext.node<TableDataSourceNode>().size();
    String text = wdComponentAPI.getTextAccessor().getText
      IMessage<ComponentName>.TABLE_HEADER_TEXT,
      new Object[] { String.valueOf(numRows) }
    wdContext.currentContextElement().setTableHeaderText(text);
    Maybe you want to provide a separate message for the case that there are no entries.
    Alternatively, you can make the attribute calculated and return the header text in the attribute getter.
    Armin

  • How just return one row of a one to many join..

    So I have a one to many join where the SMOPERATOR table has data I need however it has a couple of rows that match the JOIN condition in there. I just need to return one row. I think this can be accomplished with a subquery in the join however have not been able to come up with the right syntax to do so.
    So:
    SELECT "NUMBER" as danumber,
    NAME,
    SMINCREQ.ASSIGNMENT,
    SMOPERATOR.PRIMARY_ASSIGNMENT_GROUP,
    SMOPERATOR.WDMANAGERNAME,
    SMINCREQ.owner_manager_name,
    SMINCREQ.subcategory, TO_DATE('01-'||TO_CHAR(open_time,'MM-YYYY'),'DD-MM-YYYY')MONTHSORT,
    (CASE WHEN bc_request='f' THEN 'IAIO'
    WHEN (bc_request='t' and substr(assignment,1,3)<>'MTS') THEN 'RARO'
    WHEN (bc_request='t' and substr(assignment,1,3)='MTS') THEN 'M'
    ELSE 'U' end) as type
    from SMINCREQ
    left outer join SMOPERATOR on SMINCREQ.assignment=SMOPERATOR.primary_assignment_group
    WHERE SMINCREQ.owner_manager_name=:P170_SELECTION and SMOPERATOR.wdmanagername=:P170_SELECTION
    AND open_time BETWEEN to_date(:P170_SDATEB,'DD-MON-YYYY') AND to_date(:P170_EDATEB,'DD-MON-YYYY')
    AND
    (bc_request='f' and subcategory='ACTIVATION' and related_record<>'t')
    OR
    (bc_request='f' and subcategory<>'ACTIVATION')
    OR
    (bc_request='t' and substr(assignment,1,3)<>'MTS')
    order by OPEN_TIMe

    Hi,
    This sounds like a Top-N Query , where you pick N items (N=1 in this case) off the top of an orderded list. I think you want a separate ordered list for each assignment; the analytic ROW_NUMBER function does that easily.
    Since you didn't post CREATE TABLE and INSERT statements for your sample data, I'll use tables from the scott schema to show how this is done.
    Say you have a query like this:
    SELECT       d.dname
    ,       e.empno, e.ename, e.job, e.sal
    FROM       scott.dept  d
    JOIN       scott.emp   e  ON   d.deptno = e.deptno
    ORDER BY  dname
    ;which produces this output:
    DNAME               EMPNO ENAME      JOB              SAL
    ACCOUNTING           7934 MILLER     CLERK           1300
    ACCOUNTING           7839 KING       PRESIDENT       5000
    ACCOUNTING           7782 CLARK      MANAGER         2450
    RESEARCH             7876 ADAMS      CLERK           1100
    RESEARCH             7902 FORD       ANALYST         3000
    RESEARCH             7566 JONES      MANAGER         2975
    RESEARCH             7369 SMITH      CLERK            800
    RESEARCH             7788 SCOTT      ANALYST         3000
    SALES                7521 WARD       SALESMAN        1250
    SALES                7844 TURNER     SALESMAN        1500
    SALES                7499 ALLEN      SALESMAN        1600
    SALES                7900 JAMES      CLERK            950
    SALES                7698 BLAKE      MANAGER         2850
    SALES                7654 MARTIN     SALESMAN        1250Now say you want to change the query so that it only returns one row per department, like this:
    DNAME               EMPNO ENAME      JOB              SAL
    ACCOUNTING           7782 CLARK      MANAGER         2450
    RESEARCH             7876 ADAMS      CLERK           1100
    SALES                7499 ALLEN      SALESMAN        1600where the empno, ename, job and sal columns on each row of output are all taken from the same row of scott.emp, though it doesn't really matter which row that is.
    One way to do it is to use the analytic ROW_NUMBER function to assign a sequence of unique numbers (1, 2, 3, ...) to all the rows in each department. Since each sequence startw with 1, and the numbers are unique within a department, there will be exactly one row per departement that was assigned the numebr 1, and we''ll display that row.
    Here's how to code that:
    WITH     got_r_num     AS
         SELECT     d.dname
         ,     e.empno, e.ename, e.job, e.sal
         ,     ROW_NUMBER () OVER ( PARTITION BY  d.dname
                                   ORDER BY          e.ename
                           )         AS r_num
         FROM     scott.dept  d
         JOIN     scott.emp   e  ON   d.deptno = e.deptno
    SELECT       dname
    ,       empno, ename, job, sal
    FROM       got_r_num
    WHERE       r_num     = 1
    ORDER BY  dname
    ;Notice that he sub-query got_r_num is almost the same as the original query; only it has one additional column, r_num, in the SELECT clause, and the sub-qeury does not have an ORDER BY clause. (Sub-queries almost never have an ORDER BY clause.)
    The ROW_NUMBER function must have an ORDER BY clause. In this example, I used "ORDER BY ename", meaning that, within each department, the row with the first ename (in sort order) will get r_num=1. You can use any column, or expression, or expressions in the ORDER BY clause. You muight as well use something consistent and predictable, like ename, but if you really wanted arbitrary numbering you could use a constant in the analytic ORDER BY clause, e.g. "ORDER BY NULL".

  • How to return mismatched rows from two tables?

    I have created two tables in the same database as below which gives the row
    count of tables across all databases before and after an DB restore
    operation.
    create table before_restore(db_name varchar(100),table_name
    varchar(1000),row_count int) insert into before_restore exec sp_msforeachdb 'USE
    [?]; select ''?'' as database_name,o.name,max(i.rowcnt ) From [?].sys.objects o
    inner join [?].sys.sysindexes i on o.object_id=i.id where o.type=''U'' group by
    o.name'
    create table after_restore(db_name varchar(100),table_name
    varchar(1000),row_count int) insert into after_restore exec sp_msforeachdb 'USE
    [?]; select ''?'' as database_name,o.name,max(i.rowcnt ) From [?].sys.objects o
    inner join [?].sys.sysindexes i on o.object_id=i.id where o.type=''U'' group by
    o.name'
    I want to compare these two tables and it should only return me rows that
    have changed after the restore operation is complete.
    Eg:
    Table xyz has rowcount of 100 before restore and the restore was not proper
    and after restore count is 50. So it should return me the result set as
    below;
    Db_name    Table_Name  row_count_before_restore    row_count_after_restore
    abc                   xyz                       100                              
       50
    Thanks!!!

    Something like below perhaps? Btw, I recommend using catalog view and dynamic management views instead of the old system tables (now called compatibility views)...
    SELECT
    COALESCE(a.db_name, b.db_name) AS db_name
    ,COALESCE(a.table_name, b.table_name) AS table_name
    ,a.row_count AS row_count_before_restore
    ,b.row_count AS row_count_after_restore
    FROM before_restore AS b FULL OUTER JOIN after_restore AS a ON b.db_name = a.db_name AND b.table_name = a.table_name
    WHERE b.row_count <> a.row_count OR b.db_name IS NULL OR a.db_name IS NULL
    Tibor Karaszi, SQL Server MVP |
    web | blog

  • How to get the row count of a Table DATA?

    Hi,
      In my Adobe form layout, I have a Table node which is bound to an internal table. Now at runtime, I want to determine the number of rows that the internal table has, i.e the row count of the DATA node of the Table. How will I be able to determine the no. of rows of the internal table at runtime using Javascript? I am not being able to find any suitable answer in this forum. Please suggest. Thanks in advance.

    Hi,
    If you bind the interactive form table to the internal table and specify some properties, the table will vary its row size according to the number of data available in the internal table.
    You have to wrap the table in a sub form,  check 'allow page break with contents' and property 'flowed'.
    the table will automatically increase its row size...
    Is this the reason for which you wanted for the row count..?
    If so, this will help you..
    Regards.
    Surya

  • Total row count - where from is that value?

    Hi,
    I need the value of total row count that is displayed at the button of portal report. I need this value to use in my java script.
    Is that value somewhere in database? Maybe any variable or hidden form element on the page?
    Where from does the portal know when to show only the previous button and when both next and previous? It must by calucated somehow.
    Thanks in advance.
    best regards
    Krzysztof Jungowski
    null

    Thanks. Just to make clear:
    Probelm:
    I need to display links to pages with part of results at the bottom of page - just like in discussion group: Pages: [1] [2] [3] ....
    Solution:
    I know that there is a hidden form on every report rendered by portal. In that form there are several elements like:
    pagenumer, minrow and maxrows. Updating these elements I can jump to every page with results.
    Total row count problem:
    The problem is that I don't know the number of pages. If I had a total row count value I would calculate the number of pages and create links only to existing pages.
    best regards
    Krzysztof Jungowski

  • How to set visible row count dynamically

    i  need to place input field so that user enters value for visible row count in ALV WEBDYNPRO

    Hi Prabhu,
    As Suggested use set_visible_row_count. First count your table entries. based on count display records.
    count = LINES( lt_n_contract ).
      IF count > 5.
        lt_table_settings->set_visible_row_count( value  = 10 ).
      ELSE.
        lt_table_settings->set_visible_row_count( value  = 3 ).
      ENDIF.
    Cheers,
    Kris.

  • How to convert an excel file where customers have partial access for selecting items.

    Please Advise,
    I have created an excel file with columns that calculates price and quantity. I need to know how my customers can access the file without seeing all my calculations, etc. and just select the number of items. I need to keep my excel formula info confidential and at the same time having the customers the ability to select the items.
    This excel file will be placed on my web site and linked where customers have access to it. They make their selections and emailed back for processing.with their selected items. If the excel file is converted into a pdf file, Then placed and linked for customer access how can customers have partial access and select in certain columns and have excel fuction for calculations?
    Thanks,
    Dan

    [discussion moved to Creating, Editing & Exporting PDFs forum]

  • How to return multiple rows in case when condition?

    I want to display the list of product names owned by a company.If no products found it should return a string like "NO PRODUCTS FOUND'
    The query I wrote working well but when the condition does not satisfy Its not returning  "NO PRODUCTS FOUND''. Can someone help me how can I do this?
    declare @Country varchar(100)='Netherlands'
    SELECT     CASE WHEN count(table4.ProductName) >0 THEN table4.ProductName 
                   ELSE 'NO PRODUCTS FOUND' END AS Product_list
    FROM              table2 INNER JOIN
                          table1 ON table2.AccountID = table1.AccountID INNER JOIN
                          table3 ON table1.[company_ID] = table3.[company_ID] INNER JOIN
                          table4 ON table4.ProductID = table2.ProductID
    WHERE    
                         table1.[country] IN (@Country)) AND table4.ProductID IN (24410, 24413, 24418, 24383,                           24384))
    GROUP BY table4.ProductName 

    Your DDL does not match your query.
    You also supplied no test data.
    You're using INNER JOINS to enforce relationships that may not exist. You're using a WHERE clause to do the same.
    Try this:
    DECLARE @table1 TABLE (accountid int not null, productID varchar(20), company_id int)
    DECLARE @table2 TABLE (accountid int not null, country varchar(20))
    DECLARE @table3 TABLE (company_id int not null, company_name varchar(20))
    DECLARE @table4 TABLE (productID int not null, productname varchar(20))
    INSERT INTO @table2 (accountid, country) VALUES (1, 'Netherlands'),(2, 'Netherlands'),(3, 'Germany')
    INSERT INTO @table1 (accountid, productID, company_id) VALUES (1,24410,1)
    INSERT INTO @table3 (company_id, company_name) VALUES (1,'one company'),(2,'two company'),(3,'three company')
    INSERT INTO @table4 (productID, productname) VALUES (24410,'a product')
    DECLARE @Country varchar(100)='Netherlands'
    SELECT t3.company_name,
    CASE WHEN count(t4.ProductName) > 0 THEN t4.ProductName
    ELSE 'NO PRODUCTS FOUND'
    END AS Product_list
    FROM @table2 t2
    INNER JOIN @table3 t3
    ON t2.accountid = t3.company_id
    LEFT OUTER JOIN @table1 t1
    ON t2.accountid = t1.accountid
    LEFT OUTER JOIN @table4 t4
    ON t1.productID = t4.productID
    WHERE t2.country = @Country
    GROUP BY t3.company_name, t4.productName

  • How to return all rows with duplicate values? Inner join not working!

    I have a 3 column table:
    location (pk), name, size
    I am attempting to select pairs of entries that have the same
    name and size but different values for location (it is the
    primary key.) My inner join does not seem to return what I need:
    select a.location, a.name, a.size, b.location, b.name, b.size
    from mytable a, mytable b where a.name = b.name and a.size =
    b.size and a.location <> b.location;

    One solution is like this:
    SELECT dname, loc, deptno
    FROM dept
    WHERE (dname, loc) IN
    (SELECT dname, loc
    FROM dept
    GROUP BY dname, loc
    HAVING COUNT (*) > 1
    ORDER BY dname, loc, deptno
    Regards
    Zlatko Sirotic

  • How to return the record count of a query to a number variable

    How would I get the record count from a query without using a cursor to step through the query and count the records individually?
    query: select * from table1 where column1 = column2
    How would I get the record count of the query above?
    thanks,
    michelle

    I figured it out
    select count(*) into theCount
    from ( select * from table1 where column1=column2 );
    thanks,
    michelle

  • How to return only rows belonging to an authenticated user?

    Hi, i have a basic JHeadstart application with a form which is currently returning all the rows of a tasks table containing tasks belonging to users, and allows update and insert of new rows to this table.
    I wish to extend this application to include a basic login screen to authenticate the users initially, and then somehow pass the username onto the Jhs form and have it return only the rows from the tasks table which have a userid matching the login username.
    So basically i want to hide the userid column from displaying on screen, and code the form so that the userid column must always match the login username during any view/update/insert/delete operation the form initiates.
    Currently the users are all separate database users and are not known/controlled by the Jdeveloper app yet, so a database connection based authentication method would be most relevent I believe, however I haven't seen any mention in the DB authentication based blogs regarding using the login information in the application such as restricting the results of a table form in the way described above.
    Any pointers appreciated,
    Thanks

    Hi,
    it's used in conjuction with JAAS / Container managed security. The user requests a page which is within a protected resource and is then prompted to login. Once logged in the user principal is available (can be referenced) in both the user interface and model layers.
    The VPD option is there to reduce the coding required in the ADF model layer.
    This article explains how to get JAAS to use a custom database LoginModule which sits undeneath JAAS.
    http://www.oracle.com/technology/products/jdev/howtos/1013/oc4jjaas/oc4j_jaas_login_module.htm
    This you how to reference the currently logged in user in the various layers within the application:
    http://brendenanstey.blogspot.com/2007/05/j2ee-container-managed-security-how-to.html
    The security setup is also covered in the ADF Developer guide which is here:
    http://download.oracle.com/docs/pdf/B25947_01.pdf
    Brenden

  • How to find total row count on weekly basis

    I have written a join query which works perfect and it give me total number of rows between two dates, however is there a way where i can modify my query so that i can see the result on weekly basis from January 2014 to may 2014
    ;WITH SourceData
    as
        SELECT tablet.Approach.ApproachId
        ,StartDateTime
        ,QuestionId, Stage
        FROM Tablet.Approach
        JOIN tablet.DataCapture ON tablet.Approach.ApproachId = tablet.DataCapture.ApproachId
        WHERE QuestionId in (9,10)
        and Stage = 2
        and StartDateTime between '2014-01-01 00:00:00' and '2014-05-20 00:00:00'
    ,RecordCnt
    AS
        SELECT COUNT(ApproachId) AS TotalInformationEffectContacts
        FROM SourceData
    Select * from SourceData Cross join RecordCnt
    order by StartDateTime asc

    Use GROUP BY datediff(ww,@startdate,@enddate)
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

Maybe you are looking for