Percentage on report page

Hi
Please can you help with this problem---
Generating report that tells the percentage of pple that failed exams, oral or written
here what I have now as count result
select distinct last_name, count(oral_reslt) Oral_Result,
count(written) written_RESULT,
from PHY_TEST
where (result='Fail'
or
PHY_RSLT='Fail')
group by (id,Last_name)
how do I calculate the percentage
Please help
Thank you

Ok, here's a little demo of how analytics can help (Vikas was right when he said ratio_to_report would work for you).
jes@DBTEST> create table phy_test(id number,
  last_name varchar2(20),
  oral_reslt varchar2(4),
  written varchar2(4));
Table created.
jes@DBTEST> insert into phy_test values (1, 'Smith', 'Fail', 'Fail');
1 row created.
jes@DBTEST> insert into phy_test values (2, 'Jones', 'Pass', 'Fail');
1 row created.
jes@DBTEST> insert into phy_test values (3, 'Williams', 'Pass', 'Pass');
1 row created.
jes@DBTEST> insert into phy_test values (4, 'Watson', 'Fail', 'Pass');
1 row created.
jes@DBTEST> commit;
Commit complete.
jes@DBTEST> select * from phy_test;
        ID LAST_NAME            ORAL WRIT
         1 Smith                Fail Fail
         2 Jones                Pass Fail
         3 Williams             Pass Pass
         4 Watson               Fail Pass
jes@DBTEST> select
  last_name,
  oral_reslt,
  written,
  ratio_to_report(1) over (partition by oral_reslt) * 100 as oral_percent,
  count(*) over (partition by oral_reslt) as oral_count,
  count(*) over () as oral_count_total,
  ratio_to_report(1) over (partition by written) * 100 as written_percent,
  count(*) over (partition by written) as written_count,
  count(*) over () as written_count_total
  from phy_test
LAST_NAME            ORAL WRIT ORAL_PERCENT ORAL_COUNT ORAL_COUNT_TOTAL WRITTEN_PERCENT WRITTEN_COUNT WRITTEN_COUNT_TOTAL
Smith                Fail Fail           50          2                4              50             2                   4
Watson               Fail Pass           50          2                4              50             2                   4
Jones                Pass Fail           50          2                4              50             2                   4
Williams             Pass Pass           50          2                4              50             2                   4
jes@DBTEST> insert into phy_test values (5, 'Wolfgang', 'Pass', 'Fail');
1 row created.
jes@DBTEST> select
  last_name,
  oral_reslt,
  written,
  ratio_to_report(1) over (partition by oral_reslt) * 100 as oral_percent,
  count(*) over (partition by oral_reslt) as oral_count,
  count(*) over () as oral_count_total,
  ratio_to_report(1) over (partition by written) * 100 as written_percent,
  count(*) over (partition by written) as written_count,
  count(*) over () as written_count_total
  from phy_test
LAST_NAME            ORAL WRIT ORAL_PERCENT ORAL_COUNT ORAL_COUNT_TOTAL WRITTEN_PERCENT WRITTEN_COUNT WRITTEN_COUNT_TOTAL
Smith                Fail Fail           50          2                5      33.3333333             3                   5
Watson               Fail Pass           50          2                5              50             2                   5
Jones                Pass Fail   33.3333333          3                5      33.3333333             3                   5
Wolfgang             Pass Fail   33.3333333          3                5      33.3333333             3                   5
Williams             Pass Pass   33.3333333          3                5              50             2                   5It should be fairly self explanatory and you should be able to adapt it to your own query.

Similar Messages

  • How do I run query per report page?

    I have a report with two subreports which both need queries to run on the fly per supplier(per report page).  All the other subreports on the page as well as the main report queries are loaded in advance before the report and includes all records needed for all suppliers.  However, these two querys that I'm trying to have run per report though can only be loaded one at a time because of the way these queries are formated (it allows a bar graph to show a label for only the current supplier on the x-axis and all other suppliers will display a "" for x-axis label, effectively only showing one legend label per report).  I already have the necessary parameter needed for the report(Pm-Supplier) so how can I run an oracle query on the fly per report page? 
    Eric
    Query 1:
    select vendor,supplierloc,commodity,ip from (select c.Vendor, q.supplierloc, c.commodity,SUM (q.indexpoints+q.lateindexpoints) AS ip
    FROM qa_occ q, glovia_prod.c_vencom@GL7TEST c
    where q.occdate BETWEEN TO_DATE ('4/1/2006', 'mm/dd/yyyy')
    AND TO_DATE ('3/9/2007', 'mm/dd/yyyy')
    and c.vendor=q.supplier
    and (upper(trim(foundby)) not like '%MARKET%' or foundby is null)
    and (upper(trim(foundby)) not like '%TRIAL%' or foundby is null)
    and (upper(trim(rank)) not like '%MARKET%' or rank is null)
    and (upper(trim(rank)) not like '%TRIAL%' or rank is null)
    and nvl(void,'N') = 'N'
    and q.supplier= @SUPPLIER
    GROUP BY C.vendor,q.supplierloc,c.commodity) qa
    union
    select '' as vendor,supplierloc,commodity,ip from (select c.Vendor, q.supplierloc, c.commodity,SUM (q.indexpoints+q.lateindexpoints) AS ip
    FROM qa_occ q, glovia_prod.c_vencom@GL7TEST c
    where q.occdate BETWEEN TO_DATE (@BegDate, 'mm/dd/yyyy')
    AND TO_DATE (@EndDate, 'mm/dd/yyyy')
    and c.vendor=q.supplier
    and (upper(trim(foundby)) not like '%MARKET%' or foundby is null)
    and (upper(trim(foundby)) not like '%TRIAL%' or foundby is null)
    and (upper(trim(rank)) not like '%MARKET%' or rank is null)
    and (upper(trim(rank)) not like '%TRIAL%' or rank is null)
    and nvl(void,'N') = 'N'
    and q.supplier<> @SUPPLIER
    GROUP BY C.vendor,q.supplierloc,c.commodity) qa
    order by commodity,ip desc
    Query 2:
    select c.name as name,c.vendor,c.ven_loc, SUM(q.indexpoints+q.lateindexpoints) as ip
    from qa_occ q,glovia_prod.ven_loc c
    WHERE q.occdate BETWEEN TO_DATE (@BegDate, 'mm/dd/yyyy')
    AND TO_DATE (@EndDate, 'mm/dd/yyyy')
    and (upper(trim(q.foundby)) not like '%MARKET%' or q.foundby is null)
    and (upper(trim(q.foundby)) not like '%TRIAL%' or q.foundby is null)
    and (upper(trim(q.rank)) not like '%MARKET%' or q.rank is null)
    and (upper(trim(q.rank)) not like '%TRIAL%' or q.rank is null)
    and q.supplier is not null
    and nvl(q.void,'N') = 'N'
    and q.supplier=@SUPPLIER
    and q.supplier=c.vendor
    and q.supplierloc=c.ven_loc
    GROUP BY c.name,c.vendor,c.ven_loc
    union
    select '' as name,c.vendor,c.ven_loc, SUM(q.indexpoints+q.lateindexpoints) as ip
    from qa_occ q,glovia_prod.ven_loc c
    WHERE q.occdate BETWEEN TO_DATE (@BegDate, 'mm/dd/yyyy')
    AND TO_DATE (@EndDate, 'mm/dd/yyyy')
    and (upper(trim(q.foundby)) not like '%MARKET%' or q.foundby is null)
    and (upper(trim(q.foundby)) not like '%TRIAL%' or q.foundby is null)
    and (upper(trim(q.rank)) not like '%MARKET%' or q.rank is null)
    and (upper(trim(q.rank)) not like '%TRIAL%' or q.rank is null)
    --and q.supplier is not null
    and nvl(q.void,'N') = 'N'
    and q.supplier=c.vendor
    and q.supplierloc=c.ven_loc
    and q.supplier <> @SUPPLIER
    GROUP BY c.name,c.vendor,c.ven_loc
    ORDER BY ip DESC

    You can't, CR considers each subreport as a separate report and therefore it makes a new connection and runs the SQL for the subreport.

  • How to show all the search result in a report page

    I have a report page which the user can enter first or last name to find the matched employees. The current report only show maximum of 15 matched results. How to show all of them in one page if more than 15.
    Also, the employee name on the report is a link, how to make the link to be conditional. ( I mean it can be a link or not based on another column)
    Thanks.
    Jen

    Hi, you can change the number of rows on the report definition page (15 is the default value)- that's also where you can change pagination and max. number of rows etc.
    About the second question - you will have to use Case or Decode in your report query and have the value as link or not based on the condition column, something like:
    Select Decode(condition_column, 'link_value', '<a href="f?p=YOUR_APP:PAGE_TO_LINK_TO:'  || :SESSION || ':::::">display_column</a>' , display_column) From .....
    Hope this helps.

  • History report page prints before printing each new document?cc=us

    How do i stop my HP Officejet 6700  Premium from printing a history report page before printing each new document, using Windows 7 & Using Microsoft Word? When I open a document and print it, it prints a history including: File Name; Directory; Template; Title; Subject; Keywords; Comments; creation Date; Change Number; Last Saved On; Last Saved By; Total Editing; Last Printed On; As of Last Printing....
    Everything worked perfectly for a year, then I had to reinstall the printer because I deleted it by mistake. I cary it with me when I travel to meetings and didn't have my install disk, so I had to download the install software. I haven't changed any settings in Word, but it appears that the report is generated from Word.
    Help will be appreciated. I can't find any other topic like mine to see an already presented solution.
    This question was solved.
    View Solution.

    Hi,
    The report indeed being generated by Word and not by the pritner driver.
    As you did not clarify your MS Office version I included the steps for Word 2010, I believe the same should also apply for Word 2007:
    From Word click the File menu, then select Options.
    Select Display from the left pane.
    Under the Printing Options sections, uncheck the box next to Print document properties.
    Click OK and try printing again.
    If you cannot find the specific option, please clarify your exact Microsoft Wiord version.
    Shlomi
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • Populate report page based on results from stored procedure

    Is it possible to populate a report page in APEX based on the results from a stored procedure? If so, how do I do it? Do I write a stored procedure with a ref cursor as out parameter?

    I would use a stored procedure to return the values for a form but not for a report. For a
    report, I would use a pipelined function. See an example here:
    http://htmldb.oracle.com/pls/otn/f?p=31517:146
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Display image in report page but just a link if file is not an image

    Hello,
    I've been working on displaying an image in a report page but need to add some logic.
    I would like to be able to call the image using a Region Source of type SQL instead of the HTML Expression. The reason for this is because I need to use logic to determine if the file is an image or not and to determine wether to show a thumbnail or just a link. I did find a "GET_BLOB_FILE_SRC" Function on the internet that suggests that I could do this but I need some help in making it work in my application.
    Here it is as a Region Source of type SQL:
    SELECT ID,
    NAME,
    CASE WHEN NVL(dbms_lob.getlength(document),0) = 0
    THEN NULL
    ELSE CASE WHEN attach_mimetype like 'image%'
    THEN '<img
    src="'||apex_util.get_blob_file_src('P4_DOCUMENT',id)||'" />'
    ELSE '<a
    href="'||apex_util.get_blob_file_src('P4_DOCUMENT',id)||'">Download</a>'
    end
    END new_img
    FROM TEST_WITH_BLOB
    If anyone can help me with this that would be appreciated.
    Thanks
    LEH

    John,
    The problem is that I do not know how to use the "GET_BLOB_FILE_SRC Function". I never got it to work but the HTML Expression did work for me. If you know how the GET_BLOB_FILE_SRC Function works then that would be helpful. I don't think it would be helpful if I posted my example on apex.oracle.com. But here is the information I have on the GET_BLOB_FILE_SRC Function.
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    GET_BLOB_FILE_SRC Function
    As an alternative to using the built-in methods of providing a download link, you can use the APEX_UTIL.GET_BLOB_FILE_SRC function. One advantage of this approach, is the ability to more specifically format the display of the image (with height and width tags). Please note that this approach is only valid if called from a valid Oracle Application Express session. Also, this method requires that the parameters that describe the BLOB to be listed as the format of a valid item within the application. That item is then referenced by the function.
    See Also:
    "About BLOB Support in Forms and Reports" in Oracle Application Express Application Builder User's Guide
    Syntax
    FUNCTION GET_BLOB_FILE_SRC (
        p_item_name           IN VARCHAR2 DEFAULT NULL,
        p_v1                  IN VARCHAR2 DEFAULT NULL,
        p_v2                  IN VARCHAR2 DEFAULT NULL,
        p_content_disposition IN VARCHAR2 DEFAULT NULL)
        RETURN VARCHAR2
    Parameters
    Table 1-28 describes the parameters available in GET_BLOB_FILE_SRC function.
    Table 1-28 GET_BLOB_FILE_SRC Parameters
    Parameter Description
    p_item_name
    Name of valid application page ITEM that with type FILE that contains the source type of DB column.
    p_v1
    Value of primary key column 1.
    p_v2
    Value of primary key column 2.
    p_content_disposition
    Specify inline or attachment, all other values ignored
    Example
    As a PLSQL Function Body:
    RETURN '<img src="'||APEX_UTIL.GET_BLOB_FILE_SRC('P2_ATTACHMENT',:P2_EMPNO)||'" />';
    As a Region Source of type SQL:
    SELECT ID,
           NAME,
           CASE WHEN NVL(dbms_lob.getlength(document),0) = 0
                THEN NULL
                ELSE CASE WHEN attach_mimetype like 'image%'
                          THEN '<img
    src="'||apex_util.get_blob_file_src('P4_DOCUMENT',id)||'" />'
                          ELSE '<a
    href="'||apex_util.get_blob_file_src('P4_DOCUMENT',id)||'">Download</a>'
                          end
            END new_img
       FROM TEST_WITH_BLOB
    The previous example illustrates how to display the BLOB within the report, if it can be displayed, and provide a download link, if it cannot be displayed.Thanks
    LEH

  • 6980 wont stop printing report pages

    Help-My 6980 Deskjet has recently started printing report pages after every print job.  It seems to go into quiet mode on its own, prints the job and then continues to print multiple report pages until I turn it off.  Of course I'm out of warranty so no help from support.

    Sorry using XP PRo with a wireless connection.  No troubles there.

  • Add a Print button to a Report Page

    I'm trying to add a Print button to a report page to render the page in printer-friendly mode and then give the user the option to send to a printer. I started with just trying to add a print button. I added a button to the region and added to the button request value javascript:window.print();. When I click on the print button, nothing happens. So I tried to add some html code:
    <form>
    <input type="BUTTON" value="Print" onClick="window.print()">
    <form>
    as a condition in Expression 1 when I selected "Current page is NOT in Printer Friendly mode". Nothing happens when I click on the print button. Can anyone offer some steps to create this functionality or point me to documentation on how to do this? I have tried the help documentation within APEX and isn't clear to me.
    Thanks

    The documentation wasn't very clear to me. I did try one suggestion to create a region on the report page and call it Print. The suggestion is then to add the following code to the Source Region section:
    <form>
    <input type='BUTTON' value="Print this page" onClick="window.print()">
    <form>
    The example however leaves out some significant information however. What is the region created as e.g. HTML, Report, Form, URL, etc?

  • How to change Number of Rows in a Tabular Form report page?

    Hi
    I am working with a tabular form to create an attendance sheet for a school using Oracle Application Express 3.0.1.00.12. Whenever I change the Number of Rows value from 10 to 1000 in the Layout and Pagination section of the report page, the SUBMIT button is not working and it is unable to process at that stage. How can I change the valu so that I can see all the rows in a single page, make changes to all rows and submit the page rightaway. Please help me.
    Thanks,
    Chak
    Edited by: user520137 on Jan 12, 2010 12:04 PM

    Hi
    I am working with a tabular form to create an attendance sheet for a school using Oracle Application Express 3.0.1.00.12. Whenever I change the Number of Rows value from 10 to 1000 in the Layout and Pagination section of the report page, the SUBMIT button is not working and it is unable to process at that stage. How can I change the valu so that I can see all the rows in a single page, make changes to all rows and submit the page rightaway. Please help me.
    Thanks,
    Chak
    Edited by: user520137 on Jan 12, 2010 12:04 PM

  • How to add a watermark at the back of the report page

    I want to add a watermark 'DRAFT' at the back of the report page.
    Could you please tell me how can I do that?
    regards

    Hello,
    I am assuming that you have the picture with written DRAFT on it. If not then create with gray scale.
    Then in report builder click on the Edit Margin button from the top toolbar in layout editor. Then import the picture from File>Import>Image menu and place anywhere in the bold lined frame. It will display as watermark in report.
    -Ammad

  • Is it possible to refresh the home page or report page automatically?

    Hi.
    I'm develping EM plugin with EM 11 extensibility.
    Is it possible to auto refresh the home page or report page?
    It contains the view data(real time 30 sec page..) select list combo at the matric detail page.
    and it is displayed on the right of the top at the database main page
    Thanks,
    wonjo.
    Edited by: wonjo on Oct 5, 2010 10:49 PM

    Also, there are enhancements in progress to the extensibility framework which will, in future versions of EM, allow this type of control over chart/table refresh for plugins.

  • How to stop to display the main report page header in the subreport!

    Hello all,
    I have an existed report that display the CR page header on every page of the report. Now I added another subreport into report footer without using link. How do I stop to display the main report page header and display the subreport in the new page with subreport header only? I really appreciate your time to help me out on this issue. Thanks.

    Hi,
    I tried to supress the page header with (onlastrecord and TotalpageCount > 1) condition, but the last page of main report without page header. I still like the page header display on last record, but not on the subreport only. How do I get it? Thanks in advance.

  • How to print new main report page based on number of records in subreport?

    Hi,
    I've a main report which prints on a pre-printed stationary with 2 subreports in the detail section.  The subreport prints multiple records.  If there are more than 6 records in the subreports, a new page should be printed with all the contents of the main report and the subreports should continue with the remaining records.  How can I do this?  I've tried incrementing a shared variable counter in the subreport and accessed that variable in the detail section of the main report to check the counter and reset the counter to 0 if it exceeds 6.  But this does not work.  All the lines till it can hit page footer are printing on first page and the second page prints only the remaining subreport lines without the other details of the main report page. 
    The main report page uses a view which returns only 1 record. The subreport returns multiple records. 
    I would certainly appreciate if any one can provide a solution for this problem. 
    Thanks,
    Ram

    hi Ram,
    sorry, i misunderstood exactly what you wanted.
    let me get this straight...
    1) if there's more than 6 records in the subreport then show only the first 6 records
    2) then (if there's more than 6 records) do a new page after the subreport
    3) then (if there's more than 6 records) show the subreport's remaining records and the rest of the report
    let know if i've got it straight.
    if that is correct, you will have received another sample report that does this. in total 3 subreports are used...one is a dummy report that adds up the number of records which is used later. there's more info on the report's design mode.
    cheers,
    jamie

  • BI Publisher report page not getting displayed on ADF

    Scenario: OBIEE 11g integration to Webcenter Portal
    The Dashboard pages which are developed in Answers are getting displayed correctly to ADF Page.
    ISSUE: But a dashboard page with BI Publisher report page displays error 404 on integration to ADF Page via BI Presentation services connection.
    This BI Publisher report shows up without any errors on the OBIEE Dashboard Page.
    thanks
    Reshmi

    Hi,
    kindly refer the below one
    http://www.rittmanmead.com/2011/05/oracle-bi-ee-11-1-1-5-new-jdeveloper-extensions/
    http://jdevelopertips.blogspot.com/2009/08/integrating-bi-publisher-into-jdevelo.html
    Thanks
    Deva

  • Since I can not log in bug report page, not even getting an error message, I'll write all my issues with ios8 here...

    Since I can not log in bug report page, not even getting an error message, I'll write all my issues with ios8 here... I have an iphone 4S and I did the last update. Now I am in trouble.
    1. When I move the "sound on/off" button, I get it buzzing 10 times before the setting is changed and I can do anything else, just not reacting to the round button on screen touches.
    2. Impossible to copy text from most websites into notes.
    3. Impossible to delete an email account in settings.
    4. Uses up the battery twice as fast as before. I have "update apps" setting turned off, just reading a couple of mails, making a couple of photos and open maps apps twice a day, and the battery is dead well before the evening.
    5. Got extremely slow, and it was getting slower and slower with every system update.
    I'm sure I forgot something... But well, that already a lot.

    Well, actually number 3 in my list is not true any more, I just tried to delete my account 15 times, then I've written my post, then half an hour later my Settings finally updated my accounts list. Whohoo
    I did not try restoring it yet, thank you for the link!

Maybe you are looking for