Interactive report totals

I have an IR with a break.
I managed to create a total on the break with the overall system.
On my report this total appears at the bottom of my break (for example, sum: 10).
Is it possible to change the following (for example, Total: 10).

Is it possible to create a grand total at the bottom of the report?

In addition, you can filter on columns that are dislpayed in report

See you soon

Gus

Published by: Gus C on February 24, 2010 02:32

Gus,

Currently it is impossible to replace the word 'SUM' to another thing, no way I know of to create the total general.

With regard to filtering, when a column is 'hidden' as it appears in the 'others' are the filter, but there is no way to hide those filter out to turn them off for the report together.

I hope this helps.

Doug
www.sumneva.com

Tags: Database

Similar Questions

  • Export and interactive report totals

    Hi all

    I tried to get the totals on the basis of an interactive report, but the only way I can find is to make it as aggregations and save it as the default report.

    The problem is when users download the report totals are missing, is it possible to have the total number, displayed and downloaded with an interactive report?

    Apex to 3.1

    Thank you

    Graham

    totally different approach would be to add totals to your choice.

    It works for some already very well grouped queries
    Something like

    select e.departmentid, d.name, count(*) emp#, avg(e.salary) sal
    from employees e
    join departments d on d.departmentid = e.departmentid
    group by e.departmentid, d.name 
    

    Displays the number of employees and the salaray average for each Department.
    Now we can add a total row using rollup, or grouping sets

    select e.departmentid,  d.name, count(*) emp#, avg(e.salary) sal
    from employees e
    join departments d on d.departmentid = e.departmentid
    group by grouping sets ((e.departmentid, d.name), ());
    
  • BUG: 4.2/5.0 interactive reports: attributes inconsistent/incorrect HEADERS in control break total lines

    When pause control and global actions are applied to an interactive report, the headers attributes generated for cells in the total break lines are incorrect.

    The cell in the total row headers attributes must contain the values of the id attributes of the column headings that apply to the total cell, which is the ID of the header cell of column with the header of the previous control break cell. In this example, the headers value of the total cell Dept 10 Sal to line 24 should consist of the value of "SAL" (line 12) Sal column header ID and the ID "BREAK_DEPTNO_1" of the line of control break Dept 10 (line 3). Instead, it includes the value 'BREAK_DEPTNO_2' of the Next control pause (line 29). The problem repeats for the ex-post control breaks. However, the model is incompatible, and the values for the final control (86 and 107) break lines are correct.

    This problem exists in APEX 4.2 and persists (even if using a different pattern of ID) to 5.0.

    <table summary="" cellpadding="0" cellspacing="0" border="0" class="apexir_WORKSHEET_DATA" id="12082517246125452">
      <tr>
        <th colspan="4" class="apexir_REPEAT_HEADING" id="BREAK_DEPTNO_1">Deptno : <span class="apex_break_headers">10</span></th>
      </tr>
      <tr>
        <th id="ENAME">
          <div id="apexir_ENAME" onclick="gReport.controls.widget(this.id)" style="text-align:center;">Ename</div>
        </th>
        <th id="JOB">
          <div id="apexir_JOB" onclick="gReport.controls.widget(this.id)" style="text-align:center;">Job</div>
        </th>
        <th id="SAL">
          <div id="apexir_SAL" onclick="gReport.controls.widget(this.id)" style="text-align:center;">Sal</div>
        </th>
      </tr>
      <tr class="even">
        <td align="left" headers="ENAME BREAK_DEPTNO_1">CLARK</td>
        <td align="left" headers="JOB BREAK_DEPTNO_1">MANAGER</td>
        <td align="right" headers="SAL BREAK_DEPTNO_1">2450</td>
      </tr>
      <tr>
        <td class="apexir_AGGREGATE_VALUE" style="white-space:nowrap;" align="left" headers="ENAME BREAK_DEPTNO_2"></td>
        <td class="apexir_AGGREGATE_VALUE" style="white-space:nowrap;" align="left" headers="JOB BREAK_DEPTNO_2"></td>
        <td class="apexir_AGGREGATE_VALUE" style="white-space:nowrap;" align="right" headers="SAL BREAK_DEPTNO_2">2450
          <br />
        </td>
      </tr>
      <tr>
        <th colspan="4" class="apexir_REPEAT_HEADING" id="BREAK_DEPTNO_2">Deptno : <span class="apex_break_headers">20</span></th>
      </tr>
      <tr>
        <th id="ENAME">
          <div style="text-align:center;">Ename</div>
        </th>
        <th id="JOB">
          <div style="text-align:center;">Job</div>
        </th>
        <th id="SAL">
          <div style="text-align:center;">Sal</div>
        </th>
      </tr>
      <tr class="odd">
        <td align="left" headers="ENAME BREAK_DEPTNO_2">SCOTT</td>
        <td align="left" headers="JOB BREAK_DEPTNO_2">ANALYST</td>
        <td align="right" headers="SAL BREAK_DEPTNO_2">3000</td>
      </tr>
      <tr class="even">
        <td align="left" headers="ENAME BREAK_DEPTNO_2">JONES</td>
        <td align="left" headers="JOB BREAK_DEPTNO_2">MANAGER</td>
        <td align="right" headers="SAL BREAK_DEPTNO_2">2975</td>
      </tr>
      <tr>
        <td class="apexir_AGGREGATE_VALUE" style="white-space:nowrap;" align="left" headers="ENAME BREAK_DEPTNO_3"></td>
        <td class="apexir_AGGREGATE_VALUE" style="white-space:nowrap;" align="left" headers="JOB BREAK_DEPTNO_3"></td>
        <td class="apexir_AGGREGATE_VALUE" style="white-space:nowrap;" align="right" headers="SAL BREAK_DEPTNO_3">5975
          <br />
        </td>
      </tr>
      <tr>
        <th colspan="4" class="apexir_REPEAT_HEADING" id="BREAK_DEPTNO_3">Deptno : <span class="apex_break_headers">30</span></th>
      </tr>
      <tr>
        <th id="ENAME">
          <div style="text-align:center;">Ename</div>
        </th>
        <th id="JOB">
          <div style="text-align:center;">Job</div>
        </th>
        <th id="SAL">
          <div style="text-align:center;">Sal</div>
        </th>
      </tr>
      <tr class="odd">
        <td align="left" headers="ENAME BREAK_DEPTNO_3">BLAKE</td>
        <td align="left" headers="JOB BREAK_DEPTNO_3">MANAGER</td>
        <td align="right" headers="SAL BREAK_DEPTNO_3">2850</td>
      </tr>
      <tr>
        <td class="apexir_AGGREGATE_VALUE" style="white-space:nowrap;" align="left" headers="ENAME BREAK_DEPTNO_4"></td>
        <td class="apexir_AGGREGATE_VALUE" style="white-space:nowrap;" align="left" headers="JOB BREAK_DEPTNO_4"></td>
        <td class="apexir_AGGREGATE_VALUE" style="white-space:nowrap;" align="right" headers="SAL BREAK_DEPTNO_4">2850
          <br />
        </td>
      </tr>
      <tr>
        <th colspan="4" class="apexir_REPEAT_HEADING" id="BREAK_DEPTNO_4">Deptno : <span class="apex_break_headers">40</span></th>
      </tr>
      <tr>
        <th id="ENAME">
          <div style="text-align:center;">Ename</div>
        </th>
        <th id="JOB">
          <div style="text-align:center;">Job</div>
        </th>
        <th id="SAL">
          <div style="text-align:center;">Sal</div>
        </th>
      </tr>
      <tr class="even">
        <td align="left" headers="ENAME BREAK_DEPTNO_4">FORD</td>
        <td align="left" headers="JOB BREAK_DEPTNO_4">ANALYST</td>
        <td align="right" headers="SAL BREAK_DEPTNO_4">3000</td>
      </tr>
      <tr>
        <td class="apexir_AGGREGATE_VALUE" style="white-space:nowrap;" align="left" headers="ENAME BREAK_DEPTNO_4"></td>
        <td class="apexir_AGGREGATE_VALUE" style="white-space:nowrap;" align="left" headers="JOB BREAK_DEPTNO_4"></td>
        <td class="apexir_AGGREGATE_VALUE" style="white-space:nowrap;" align="right" headers="SAL BREAK_DEPTNO_4">3000
          <br />
        </td>
      </tr>
    </table>
    
    

    Hello

    My apologies for the delay in responding and thank you for the detailed description of the issue.

    I could easily replicate this and filed bug 20889405 to follow, which will fix us as soon as possible. There is no workaround solution currently I'm afraid.

    Thanks again for posting this.

    Kind regards

    Anthony.

  • Get total control of interactive reports paging lines

    I use APEX 4.2.5 on a 11g R2 database, and I'm trying to use jquery to get the total of the lines in an interactive report (user wants to see it is separate pagination control).  We use the X - Y of Z as a paging configuration.  I got the idea to use the following to get the value and assign it to a page element in a dynamic action.

    $('#apexir_DATA_PANEL.fielddata').text ();

    (Monday morning and I am facing a brainfart, OK...) Should be a simple question and answer, but this is not the case...)

    Thank you

    Tony Miller
    Software LuvMuffin
    Ruckersville, WILL

    Found answer here its backlog of the forum: first and last pages of the interactive report

    Thank you

    Tony Miller
    Software LuvMuffin
    Ruckersville, WILL

  • Formula for Interactive report calculation field - Total amount per order

    Hello

    I use interactive report of the Apex 3.0 as a customer and want to build a formula for the scenario below.
    This is the more difficult scenario to date.

    There are three fields: 'NO ORDER', 'TYPE of PRODUCT","AMOUNT ".
    For example,.

    'NO ORDER' / 'PRODUCT TYPE' / 'AMOUNT '.

    101 / license / 10000
    101 / license / 5000
    101 / support / 2000
    101 / support / 1000

    102 / License / 5000
    102 / License / 2000
    102 / support / 1000
    102 / support / 500

    I want to add two fields 'Total license' and 'Total support' calculation by command.
    The result should be as follows:

    'NO ORDER' / 'PRODUCT TYPE' / 'AMOUNT' / 'Licence Total' / 'Total support '.

    101 / license / 10000 / 15000 / 3000
    101 / license / 5000 / 15000 / 3000
    101 / support / 2000 / 15000 / 3000
    101 / support / 1000 / 15000 / 3000

    102 / License / 5000 / 7000 / 1500
    102 / License / 2000 / 7000 / 1500
    102 / support / 1000 / 7000 / 1500
    102 / support / 500 / 7000 / 1500

    Would appreciate your help.

    Thank you
    Guy

    You can use the fields of IR calculation for a single record. So you can not "anticipate" or sum over an order or product_type.
    You have to solve in your query IR itself.
    You can get (something like) that with:

    select order_no
    , product_type
    , amount
    , (select sum(amount) from test2 b where a.product_type = b.product_type and a.order_no = b.order_no) total
    from test2 a 
    

    Or more elegant and better performance wise with analytical functions:

    select order_no
    , product_type
    , amount
    , sum(amount) over (partition by order_no,product_type) total
    from test2 a 
    
  • Interactive report with alternating lines - 5 APEX

    Heyho guys.

    I got a task to set alternating line colors in my interactive report.

    IM using Oracle 11 g Database XE with APEX 5.0.0.00.31 2.

    I searched current debates and following this thread:

    https://community.Oracle.com/thread/912414?TSTART=0

    I followed the comments written there and I tried with javascript, they spoke aboud (I'm a newbie using javascript)

    I pasted the following in my page header:

    < script type = "text/javascript" >

    IT IS THE INTERLACING

    function decorateDataGrids (strClass) {}

    var tables = document.getElementsByTagName ("table");

    for (var i = tables.length; i-;)) {

    If (tables.className == strClass) {}
    var gridRows = tables [i] .getElementsByTagName ("tr");
    for (var j = gridRows.length; j-;)) {If (j %2) {gridRows [j] .className = "even" ;}}
    }
    }
    }
    < /script >

    < style >
    / * THIS REPLACES THE DEFAULT STYLES OF THE APEX * /.
    table.apexir_WORKSHEET_DATA tr.even td {}
    background-color: #F1F5FA! important;
    }

    table.apexir_WORKSHEET_DATA td {}
    background-color: #FFFFFF! important;
    border: 1px solid #B3B3A7! important;
    padding: 4px 8px! important;
    }
    < / style >

    And called in my link to my column ID text field via:

    "< img src =" "#IMAGE_PREFIX #edit.gif" alt = "" onload = "decorateDataGrids ('apexir_WORKSHEET_DATA'); ">

    If I start the page now, nothing happens.

    In the thread, we talk about bad SEO of the IR:

    "OK here's why the code does not work." When you use getElementsByTagName, you get a collection, not a single item.

    So when you make the comparison to see if the class of the table is an ApEx IR type, you need to reference the current table, not the entire collection. As follows... »

    But I don't understand how I'm doing the right reference.

    Someone at - it an idea to get this race?

    Thank you

    pleNn

    pleNn wrote:

    Heyho guys.

    I got a task to set alternating line colors in my interactive report.

    IM using Oracle 11 g Database XE with APEX 5.0.0.00.31 2.

    I searched current debates and following this thread:

    https://community.Oracle.com/thread/912414?TSTART=0

    I followed the comments written there and I tried with javascript, they spoke aboud (I'm a newbie using javascript)

    I pasted the following in my page header:


    for (var j = gridRows.length; j-;)) {If (j %2) {gridRows [j] .className = "even" ;}}
    }
    }
    }

    And called in my link to my column ID text field via:

        

    If I start the page now, nothing happens.

    In the thread, we talk about bad SEO of the IR:

    "OK here's why the code does not work." When you use getElementsByTagName, you get a collection, not a single item.

    So when you make the comparison to see if the class of the table is an ApEx IR type, you need to reference the current table, not the entire collection. As follows... »

    But I don't understand how I'm doing the right reference.

    Someone at - it an idea to get this race?

    It's all totally obsolete with respect to the 5.0 APEX where interactive reports have been completely redesigned and rebuilt.

    To complete the full version number of APEX, always indicate what theme and browser (s) / version (s) you use when asking questions of shape/layout visual layout.

    To go from rank (Zebra) when you use the universal theme distribution in interactive reports, see Re: interactive report - no line scratched?

  • Query does not work in: interactive report _ APEX

    Hello

    I have two table QB_COLLEGE_DETAILS and QB_STUDENT_DETAILS, in the college details are stored in the QB_COLLEGE_DETAILS table and by studying the details are stored in the QB_STUDENT_DETAILS table. In the primary key table and foreign key in the COLLEGECODE.  Now, I created the interactive report using code below, but does not receive the correct value in the number of student column (see image below).

    SELECT COLLEGENAME, COLLEGECODE, COORDNAME, COORDEMAIL,

    (SELECT count (s.STUDENT_REGISTER_NUMBER) AS STUD_COUNT of QB_COLLEGE_DETAILS c, s QB_STUDENT_DETAILS

    where c.COLLEGECODE = s.COLLEGECODE) "STUDENT_COUNT".

    of QB_COLLEGE_DETAILS;

    Report.JPG

    My requirement is necessary find the number of students at the corresponding College. When I used above mentioned request that total student number appear in all lines.

    could you add your suggestion, I have to do?

    Thank you

    Issac

    ISSAC-Oracle wrote:

    I have two table QB_COLLEGE_DETAILS and QB_STUDENT_DETAILS, in the college details are stored in the QB_COLLEGE_DETAILS table and by studying the details are stored in the QB_STUDENT_DETAILS table. In the primary key table and foreign key in the COLLEGECODE.  Now, I created the interactive report using code below, but does not receive the correct value in the number of student column (see image below).

    SELECT COLLEGENAME, COLLEGECODE, COORDNAME, COORDEMAIL,

    (SELECT count (s.STUDENT_REGISTER_NUMBER) AS STUD_COUNT of QB_COLLEGE_DETAILS c, s QB_STUDENT_DETAILS

    where c.COLLEGECODE = s.COLLEGECODE) "STUDENT_COUNT".

    of QB_COLLEGE_DETAILS;

    My requirement is necessary find the number of students at the corresponding College. When I used above mentioned request that total student number appear in all lines.

    could you add your suggestion, I have to do?

    What you need to do is ask questions properly, providing useful information that allowing the problem can be reproduced, rather than unnecessary screenshots.

    This is the base of SQL. Oracle run internal SQL training courses?

    There is no correlation in your "virtual column" subquery to restrict the number of students for each college. The request must be:

    select
        c.collegename
      , c.collegecode
      , c.coordname
      , c.coordemail
      , (select count(s.student_register_number) as stud_count from qb_student_details s where c.collegecode = s.collegecode) "STUDENT_COUNT"
    from
        qb_college_details c
    

    However, unless there are a large number of colleges to which no students registered, it is likely that it will be more efficient to use an outer join:

    select
        c.collegename
      , c.collegecode
      , c.coordname
      , c.coordemail
      , count(s.student_register_number) student_count
    from
        qb_college_details c
          left outer join qb_student_details s
            on c.collegecode = s.collegecode
    group by
        c.collegename
      , c.collegecode
      , c.coordname
      , c.coordemail
    
  • Is it possible to generate an email based on an interactive report

    Hi guys I just wanted to know if its possible to generate an email for example dynamically according to the results of an interactive report.

    If I had an interactive report built a table that has a column named "total" and the data in this column would Ida be or not and if the result is "" then a reminder should be sent to this user where assessment = no.. Is this possible and how. Thank you

    p.s

    (app_user = email address) 

    If you're stuck and want a quick and dirty solution, you may just have a PL/SQL loop in the part of the State of your report as in the following pseudocode.

    Cursor c_report is

    for c_report_rec loop c_report

    end loop;

    Returns true; -You must return true at the end so the report will display

    This method really is a bad practice because it means that you run the query twice (once in PL/SQL and once in the report), but if it stops your hair going gray is to you, whether to use it or not :-)

    If you do not need to send emails at the time of the report, you might want to consider provide a trigger update on the underlying table. For example, when the column is set to 'no '.

  • Interactive report case triggering a dynamic action

    Hello

    My interactive report is built, based on the following query

    SELECT ID_OPERACION, NOMBRE_CLIENTE, TOTAL_PAGAR, APEX_ITEM. CHECKBOX (1, O.ID_OPERACION, "onclick ="f_UpdateCollection (this)"', a.c001") "Seleccionar"

    OPERACIONES o, apex_collections a

    WHERE the a.c001 (+) = O.ID_OPERACION

    and a.collection_name (+) = "OPE_COLLECTION".


    I use a collection because I don't want to lose the selected controls caused by paging.


    I would like to add a dynamic action that each time check box is selected, an element (P5_TOTAL_SELECCIONADO) summarizes the column TOTAL_PAGAR of all the checkboxes that are selected and each time a checkbox is unchecked the Total_seleccionado subtracts the value of the selected item.


    How can I do?

    Hi Eva,

    Please check again your application and see if it's what you thought.

    I made a few changes. First, here you were talking about P5_... the elements in your workspace apex.oracle, the page number is 1, so I changed the P5_... elements of P1_...

    Then, you let the fire on the boxes page laod on, but you don't want t function to begin to evaluate during page loading.

    There were also a few errors in the javascript code, I suggested. The VALOR_PAGAR selector was not correct, I've changed a little bit. Also all selected text values are strings and adding javascript strings will be just concatonate them. I made string number conversion for you, also taken into account that null values (P1_TOTAL_SELECCIONADO on page loading is null) cannot be cast to number.

    The result is:

    var VALOR_PAGAR = $(this.triggeringElement).closest('tr') .find ('td [headers = "VALOR_PAGAR"]') .text)

    var TOTAL_SELECCIONADO = $v ('P1_TOTAL_SELECCIONADO')

    VALOR_PAGAR = (isNaN (parseInt (VALOR_PAGAR) = VALOR_PAGAR)? 0: VALOR_PAGAR)

    TOTAL_SELECCIONADO = (isNaN (parseInt (TOTAL_SELECCIONADO) = TOTAL_SELECCIONADO)? 0: TOTAL_SELECCIONADO)

    var total = VALOR_PAGAR + TOTAL_SELECCIONADO

    $s ('P1_TOTAL_SELECCIONADO', total)

    This is the code to add checkboxes checked, false action is the same except for total, which is:

    var total = VALOR_PAGAR - TOTAL_SELECCIONADO

    Kind regards

    Vincent

  • Summary in interactive report

    Hi all! help me pls...

    I can summary in interactive report after that filter has been applied?

    For example, I have the EmpSal table with the data:

    EmpNo SAL
    1100
    1200
    2300

    I use request

    Select empno, sal, sum (sal) on (Partition 1) as 'total' of EmpSal

    as the source of the region for my interactive report, and I see the result:

    EmpNo SAL Total
    1100600
    1200600
    2300600

    If I run the search on EmpSal with empno = 1, I can see this result:

    EmpNo

    SAL Total 11006002100600

    but I want to see summary after filtering, as

    EmpNo Sal

    Total

    1100300
    1200300

    It is posible?

    Please excuse my bad English...

    Delete the Total of column of the report query and use the aggregation feature that is integrated into interactive reports instead. Save the report which follows that by default.

  • Increase the performance of research in the interactive report

    Hello

    I created a report that around 10,000 + records. To load the report, it does not have a lot of time. But when I do a search in interactive report that it takes a lot of time. Please suggest me how to increase the performance of interactive research.

    I use Oracle apex 3.2 and Oracle 10 g XE database.


    Please suggest me.

    Thank you
    Sudhir

    Antonio,

    Pagination: thank you. My concern was if pagination is in the form "x y z", where z is the total number of lines, then all lines may need to be returned to produce the total number.

    Function: Nice modular approach. As suggested above, four by rank function calls could produce a LOT of overhead in APEX (or elsewhere). A way to see if it is part of the problem, replace the code in function just a call with the code online and see if you get a large (15 to 20%) to accelerate.

    Howard

  • Interactive report gives ORA - 20001:error

    Hello

    I am reading a table of SQL Server and displays the output in the interactive report. SQL Server read via database public and connected to the database link Oracle via DG4MSQL. The error I get is:
    ORA-20001: get_dbms_sql_cursor error ORA-02070: SQL SERVER database does not COUNT in this context

    However when I run the same report as usual report it works fine.

    The SQL query behind the report is:
    SELECT * FROM TRANSP_COMP_V;
    The code behind the display is:
    CREATE OR REPLACE VIEW TRANSP_COMP_V AS
    (
    select 
    "Usr_Name",
    "Usr_Handle", 
    "BLoc", 
    "SLC_Hand"
    from ord.Req@sqlserver);
    Where @sqlserver is the link of public database to SQL Server 2008 R2.

    I tried the following:

    (1) used instead the name of each column * and got the same result
    (2) Rebult and respected the view several times. No problem during compilation
    (3) tested and ran the view independently and the SQL query in SQL Studio without any problem

    Is there any restriction on the interactive report during playback of the external data source (such as SQL Server through ODBC)? The error itself is confusing, as I'm not using COUNTY anywhere.

    Thank you very much.


    Using APEX 4.1.1 running in the Oracle Database 11 G R2 (windows x 64) (topic 23)

    It may be different depending on the style of the selected candidates paging - as long as total nbr of lines is not indicated, he might be allowed.
    APEX product managers may be able to describe some internal workings that explain why it does not work for an IR.

    It is one of the best examples out there for the pipeline functions. It's just a feeling - something I'll try, but I have not worked with external sources in a long time.
    http://www.Oracle-Developer.NET/display.php?ID=207

    Scott

  • Stop interactive report load Rinning

    Is it possible to stop an interactive report to run when the page is loaded.
    When my users click on the link to the page that contains the report, it takes a while to load.
    Is it possible to run only the report after they entered a setting.
    I could hide the report until they enter a parameter by using apexir_PANEL, but not totally stop to run.

    See you soon

    Gus

    When my users click on the link to the page that contains the report, it takes a while to load.

    The request was perhaps need some settings?

    After, they entered a parameter

    http://download.Oracle.com/docs/CD/E17556_01/doc/user.40/e15517/app_comp.htm#BABDHIDJ

    What kind of setting? A column IR filter? See the documentation for ways to spend these 'settings' of an IR in the 'link to the page that contains the report.

  • BI publisher and interactive report

    My shop has recently installed BI publisher (10.1.3) to improve printing report apex v4.
    After my initial tests, it seeems the report print report regular sql out of the box. But I can't find a way to print interactive reports with total, County, subtoal... It is possilble to create an interactive report at the apex and appeal of printing that can use the power of the editor of BI? In other words, we are looking for printed materials "you get what you see" but not a cleaning of the screen.

    Can you help me? Thank you very much



    Munshar

    To generate a report of IR in PDF format, you must do so using FOP. I don't think you can use BI Publisher at all if you use an interactive report...

    Thank you

    Tony Miller
    Webster, TX

    There are two types of pedestrians - the living and the dead.

    If you answer this question, please mark the thread as closed and give points where won...

  • Interactive report returns misleading data because of the limit ROWNUM

    Hi, we have relied on the internal decision-making interactive reports widespread in our society, and they have been very popular. However, a user has found an inconsistency of data when sorting to a report because the ROWNUM limit: APXWS_MAX_ROW_CNT is applied before the user requested the ORDER BY clause. We run Apex version 3.2.0.00.27 on a 10.2.0.4 database.

    Request quotes from our application IR returns citing custom and the number of lines by default is 100 (and is editable by the user). The user wants to see the most recent citations, so he chose the column heading "Date of creation" and simply applied a descending filter. The last quote returned was dated last week. However, if he has applied an additional filter of "date of creation last week", he sees today date and for most of the current quotation lines.

    When I ran on its IR application debugging, I see that the ROWNUM limit is applied first, followed in ORDER BY. This means that the database retrieves the x first lines that match the provided parameters and then orders the result set. However, this isn't what the user meant, he wanted the first lines of an ordered set.

    This is the result of the query to debug (deleted community because it is long):
    select 
           "QUOTE_NUMBER",
           "CUSTOMER",
           "CUST_CONTACT",
           "QUOTE_STATUS",
           "TOTAL_PRICE",
           "TOTAL_WEIGHT",
           "WHSE",
           "SHIP_DATE",
           "PO_NUMBER",
           "ORACLE_REFERENCE",
           "INSIDE_SALESREP",
           "OUTSIDE_SALESREP",
           "CREATION_DATE",
           "ID",
           "ORA_CUST_ID",
           "CUST_CONTACT_ID",
           count(*) over () as apxws_row_cnt
     from (
    select  *  from (
    SELECT 
      kh.id,
      kh.ora_cust_id,
      kh.quote_number quote_number ,
      kh.cust_contact_id,
      k2_customers_pkg.get_contact(cust_contact_id) cust_contact ,
      k2_customers_pkg.get_cust_name(kh.ora_cust_id)customer,
      k2_customers_pkg.get_cust_number(ora_cust_id)
    
     ( ......... more sql goes here )
    
    AND k2_customers_pkg.get_outside_salesrep_number(kh.ora_site_id)||'%' LIKE :P64_OUTSIDE_SALES||'%'
    AND kh.whse_code like :P64_WAREHOUSES||'%'
    AND ((1=
        CASE WHEN :P64_ITEM_ID IS NULL THEN
            1
        ELSE
            (SELECT 1
               FROM k2_quote_lines kl
               JOIN k2_ingredients ki
                 ON ki.quote_line_id=kl.id
              WHERE (1=1
                AND kh.id=kl.quote_id
                AND ki.ora_item_id=:P64_ITEM_ID AND ROWNUM=1))
        END)
        OR 1=(
            SELECT 1 FROM k2_quote_lines kl WHERE kl.quote_id=kh.id AND kl.part_id=:P64_ITEM_ID AND ROWNUM=1
        ))
    )  r
    ) r where rownum <= to_number(:APXWS_MAX_ROW_CNT) 
     order by "CREATION_DATE" DESC,"QUOTE_NUMBER" DESC
    However, what the user must have the ORDER BY applied first, then the limit. I realize performance can be affected, but users are now alarmed that they cannot trust these reports. I'm tempted to connect a SR with Oracle on it.

    Any ideas on that? What is this problem fixed in 4.0?

    Thank you, Moritz Wolf

    Hi Wolf,

    I don't think that the problem is with the number of rows displayed. I think that it is a function of the attribute of the ratio "number of lines". And as assistance at the level of the elements of this attribute indicates "defines the maximum number of rows in the query. Note that this attribute impact on performance. Get fewer lines can improve performance and get thousands of lines can adversely affect performance. »

    You can set the maximum number of rows to an artificially high - greater number that we'll never be your total number of lines. But this does not alter the fact that the ORDER BY still apply on the outer part of your query.

    Joel

Maybe you are looking for