Calling function in report region

Hi all
I have report with download link to call a procedure(DOWNLOAD_PROCEDURE) in database
Its not working can any one help me
select id id2,
       id del,
case when trim(file_status) = 'Complete' then
   htf.anchor('/pls/apex/DOWNLOAD_PROCEDURE?p_id='||"APEX_RPT_PARSE"."ID" ||'&p_type=test','<img src="#IMAGE_PREFIX#ed-item.gif" border="0" alt="Download File Created">')
else
  'Processing'
end download,
       file_status,
       to_char((dbms_lob.getlength(OUTPUT_FILE2))/1024,'999,999,990.00') file_size,
                to_char(created_DATE,'mm/dd/yyyy hh:mi:ss am') START_DATE,
                 to_char(END_DATE,'mm/dd/yyyy hh:mi:ss am') END_DATE,
      FILE_TYPE    
        from apex_table
where file_type = 'test'
order by id descwhen i click on link
I am getting following url
http://apex.oracle.com/pls/apex/DOWNLOAD_PROCEDURE?p_id=29&p_type=test

Hi,
You could try explain bit more how it do not work and what you expect link URL be.
But I guess your problem is that you can not call procedures in URL on apex.oracle.com.
And I do not know is it allowed to do that in there even you make request for it.
Regards,
Jari
Edited by: jarola on Sep 12, 2010 12:54 PM
Edited by: jarola on Sep 12, 2010 1:02 PM
It seems you can call procures in URL on apex.oracle.com. Maybe you did just forgot grant execute permission ?

Similar Messages

  • Javascript calling not working properly in report region

    Hi All,
    I know it is quite simple question but i am unable to do this. In one tabular form with one blank row i have to put client side validation (javascript) so that user cannot enter nonnumeric value and value should be of min 5 digit.
    How i proceed:
    1: Have written two javascript function:
    function numOnly3()
    if(!((event.keyCode>=48)&&(event.keyCode<=57)))
    event.keyCode=0;
    alert("Enter Only Numeric Values");
    //event.focus();
    else event.keyCode = event.keyCode;
    function validateNumber3(itemValue)
    if((itemValue.value).length<5)
    alert("Please Enter 5 digit Value for the Part List Group");
    itemValue.focus();
    return false;
    2: calling these function in report region like :
    htmldb_item.text (16, parts_list_group, 10,5,'onKeyPress=numOnly3(); onBlur=validateNumber3(this);') parts_list_group
    after union :
    htmldb_item.text (16, NULL, 10,5,'onKeyPress=numOnly3(); onBlur=validateNumber3(this);') parts_list_group
    problem:
    when i am enetring non numeric valuse first its giving alert message "Please Enter 5 digit Value for the Part List Group" after clicking ok its giving alert message "Enter Only Numeric Values";
    but what i want in case user is enetering non numeric it should delete and alert
    "Enter Only Numeric Values" but first it is alerting "Please Enter 5 digit Value for the Part List Group" then after clicking ok alerting "Enter Only Numeric Values".
    if i am enetring 3 digit only then its giving correct message that "Please Enter 5 digit Value for the Part List Group".
    so my requirement is in case any user is entering non-numeric data including dot symbol then it should delete and pop up message that "Enter Only Numeric Values".
    may be calling function in the region wroung. can any one suggest me where is wroung and what should i do?
    Thank You,
    Amit

    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    *Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    This may be caused by a recent Flash 11.3 update.
    See:
    *https://support.mozilla.org/kb/keep-flash-up-to-date-and-troubleshoot-problems
    *https://support.mozilla.org/kb/flash-crashes-or-does-not-load-firefox-13
    *http://forums.adobe.com/thread/1018071?tstart=0
    *http://blogs.adobe.com/asset/2012/06/inside-flash-player-protected-mode-for-firefox.html

  • Calling a function in apex region

    Hi
    I want to call a function from a package into Apex report region , but it wont the parse
    i tested in sql dev successfully
    sample code goes like this ..
    SELECT DISTINCT SOR_OFFENDER.FIRST_NAME ||' ' ||
    SOR_OFFENDER.MIDDLE_NAME || ' ' ||
    SOR_OFFENDER.LAST_NAME as "Name",
    SOR_OFFENDER_DETAILS.get_offlu_url(:p216_detail) ---package where function is define
    FROM SOR_OFFENDER,
    SOR_LOCATION
    WHERE SOR_OFFENDER.OFFENDER_ID = SOR_LOCATION.OFFENDER_ID
    AND :p216_detail = SOR_LOCATION.OFFENDER_ID
    any idea /help
    Edited by: Red_Bull on Aug 8, 2012 3:02 PM

    Tony
    I have to use this function to link other page or portal , using different parameter on different reports.
    CREATE OR REPLACE FUNCTION
    get_offlu_url (p_offender_id IN NUMBER) return VARCHAR2
         as
        temp_url_string varchar2(300);
        final_url_string varchar2(300);
        v_doc_num off_profile.doc_num%type;
        v_booking_id off_profile.offender_book_id%type;
        begin
           select http||server||port||dad||start_page into temp_url_string
            from offlu_url;
           select doc_num, offender_book_id into v_doc_num, v_booking_id
             from off_profile
             where offender_id = p_offender_id;
           final_url_string := temp_url_string||'doc_num='||v_doc_num||'&abc='||v_booking_id;
           return final_url_string;
        exception
           when too_many_rows then
               v_doc_num := 0;
               v_booking_id := 0;
        END get_offlu_url;

  • Converting SQL Report Region to PLSQL Function Body Returning SQL Query

    All:
    I want to convert my SQL Report Region to a PLSQL-generated SQL Report Region so that I can eliminate where clauses dynamically and speed up my app, and also so that I can provide additional sorting options.
    <br><br>
    My problem is that I have lots of embedded single quotes that already are coded as 3 single quotes in the SQL Report Region. I am not sure at all how to code them within the PLSQL.
    <br><br>
    As example, here is one column from my query:
    <br><br>
    select decode(nvl(g.date_sub_1,g.date_rec_1), null, decode(g.article, 0, 'E', 1, 'U'), '< a href="javascript:unElevate( ' ' ' || g.grid || ' ' ',' ' ' || g.natca || ' ' ')">' || decode(g.article, 0, 'E', 1, 'U') || '< /a>') "Reverse" from g_table g
    <br><br>
    (Note that I added spaces within the code so it would display properly in the browser.)
    <br><br>
    To clarify, that's a double quote before javascript, and then 3 single quotes before the first concatenation group, then 3 single quotes after the second concatenation group, then 3 single quotes before the third, 3 single quotes after the fourth followed by an end-paren followed by a double quote etc.
    <br><br>
    My question is, what do I do with these triple-single quotes within PLSQL? Probably a no-brainer for the experienced folks, but I am thinking like a mobius strip at this point.
    <br><br>
    Bill
    Message was edited by:
    [email protected]
    Message was edited by:
    [email protected]
    Message was edited by:
    [email protected]

    Scott,
    I think that feature was made for my situation! I keep getting
    Function returning SQL query: Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the generic columns checkbox below the region source to proceed without parsing.
    (ORA-20001: Unable to bind :43 verify length of item is 30 bytes or less. Use v() syntax to reference items longer than 30 bytes. ORA-01006: bind variable does not exist)
    I did chop the query up into little bits, i.e.
    p_sql := p_sql || q'! ... !';
    p_sql := p_sql || q'! ... !';
    p_sql := p_sql || q'! ... !';
    return p_sql;
    But I'm not sure what I'm supposed to do here.
    Thank you.
    Bill

  • CALL FUNCTION SEND ERROR when displaying attendance report in PDF format.

    We implemented SSO/webgui.  The users did not have any issues with printing reports from SAPGUI.  In webgui, however, we had to define a Local PDF1 printer, per SAP Note  771683.  When users prints this report, it is generating 1-5 CALL_FUNCTION_SEND_ERROR.  We have Central Instance and 5 additional instances on 3 app servers.  Sometimes it generates 1 dumps, sometimes 2, etc.  The dump do not occurred on the instances you are logged into. The dump contains the following:
    ShrtText                                                      
        " " (I/O error)                                           
    What happened?                                                
        "CPIC-CALL: 'ThCMSEND'#connection closed#"                                                                               
    An error occurred when executing a Remote Function Call.    
    Error analysis                                                           
        An error occurred when executing a Remote Function Call.                                                                               
    "CPIC-CALL: 'ThCMSEND'#connection closed#"                                                                               
    Status of connection.... "CODE=CM_DEALLOCATED_NORMAL CM_SEND_RECEIVED
         CM_COMPLETE_DATA_RECEIVED SAPCODE=0 CONV=04892091"                  
        Internal error code.... "RFC_IO5"                                                                               
    There is an error in the communication system. To clarify            
        and resolve the error, contact your system administrator.                                                                               
    Transaktion......... " "                                                    
      Programm............ "SAPLSICM"                                             
      Dynpro.............. "SAPMSSY1 3004"                                        
      Dynprozeile......... 2                                                                               
    Informationen zum Aufrufer des Remote Function Calls (RFC):                 
      System.............. "HRP"                                                  
      Datenbank-Release... 640                                                    
      Kernel-Release...... 640                                                    
      Verbindungstyp...... 3 (2 = R/2, 3 = R/3, E = Extern, R = Reg. Extern)      
      Aufrufsart.......... "asynchron with reply (imode 0)" (S = Synchron, a/A =  
       Asynchron, T = Transakt. )                                                 
      Mandant............. 600                                                    
      Benutzer............ "CG1981"                                               
      Transaktion......... " (Program: SAPLSICM)"                                 
      Funktionsbaustein... "ICM_CACHE_UPLOAD"     
    Information on where terminated                                                                  
        The termination occurred in the ABAP program "SAPLSICM" in "ICM_CACHE_UPLOAD".               
        The main program was "SAPMSSY1 ".                                                                               
    The termination occurred in line 18 of the source code of the (Include)                      
         program "LSICMV11"                                                                               
    of the source code of program "LSICMV11" (when calling the editor 180).                      
    Source Code Extract                                                                               
    Line  SourceCde                                                                               
    1 *******************************************************************                        
        2 *   THIS FILE IS GENERATED BY THE FUNCTION LIBRARY               **                        
        3 *   NEVER CHANGE IT MANUALLY, PLEASE!                            **                        
        4 *******************************************************************                        
        5 FORM ICM_CACHE_UPLOAD %_RFC.                                                               
        6 * Parameter declaration                                                                    
        7 DATA URL TYPE                                                                               
    8 ICMURL                                                                               
    9 .                                                                               
    10 DATA DATA TYPE                                                                               
    11 ICMDATA                                                                               
    12 .                                                                               
    13 DATA GLOBAL LIKE                                                                               
    14 SY-INDEX                                                                               
    15 .                                                                               
    16 * Assign default values                                                                    
       17 * Call remote function                                                                     
    >>>>>   CALL FUNCTION 'ICM_CACHE_UPLOAD' %_RFC                                                   
       19      EXPORTING 
      20        URL = URL      
      21        DATA = DATA    
      22        GLOBAL = GLOBAL
      23   .                   
      24 ENDFORM.                                                                               
    We are on ERP 2004, kernel level 156, and Basis SP18.  I have Adobe Reader 8.
    Our CI Service Port is 8009.
    I have not seen any posting if there is a PDF limitation, e.g., width limitation, report contains rows highlighted in various colors.

    Dear Elaine,
    check notes
    <a href="https://service.sap.com/sap/support/notes/764734">764734</a>
    <a href="https://service.sap.com/sap/support/notes/688372">688372</a>
    or you might want to try to comment out line 118 of the function module
    ICM_CACHE_UPLOAD which reads like this
    PERFORMING RECEIVE_DATA_UPLOAD ON END OF TASK
    If this does not solve the problem, give a detailed description on how to reproduce the dump and put that into an error message with SAP. It should go to BC-CST-IC.
    Best Regards,
    Tim

  • Bapi Function call from Crystal reports 2008. import parameters syntax.

    Dear,
    I have an issue with calling a function directly from Crystal reports (2008) in the R3 system.
    (if this belongs in another thread , please add the link if moved !)
    I try to get data through function "BAPI_CLASS_GET_CLASSIFICATIONS".
    Till now all possible input parameters have no data-result.
    I already read other threads stating that 'for example' the Language key needs to be provided in a single character. 'E' in stead of 'EN'.
    I also already created a Z-wrap-function that fills out all input parameters 'hardcoded'. This works.
    clearly there are som syntax changes in passing the values to R3 when called from Crystal Reports.
    Can someone state which syntax has to be followed for numeric fields, for datefields etc. (so when i make these dynamical, I know which syntax should be the outcome of the formula)
    in my function that doesn't work I use these selections:
    (this function is called in a standard report only calling this function)
    {BAPI_CLASS_GET_CLASSIFICATIONS_1.I_LANGU_ISO} = "E" and
    {BAPI_CLASS_GET_CLASSIFICATIONS_1.I_LANGU_INT} = "E" and
    {BAPI_CLASS_GET_CLASSIFICATIONS_1.T_CLASS_OBJECTS.OBJECT_TYPE} = "MARA" and
    {BAPI_CLASS_GET_CLASSIFICATIONS_1.T_CLASS_OBJECTS.OBJECT_KEY} = "000000000000000085" and
    {BAPI_CLASS_GET_CLASSIFICATIONS_1.I_CLASSNUM} = "DSWTEST" and
    {BAPI_CLASS_GET_CLASSIFICATIONS_1.I_CLASSTYPE} = "001" and
    {BAPI_CLASS_GET_CLASSIFICATIONS_1.I_KEY_DATE} = Date (2011, 08, 05)
    I already tried other languages or the 'EN' as input.
    (I would like to know how the date is passed exaclty to R3.)
    The function is of course RFC enabled.
    when I call the my Z-function with predefined inputparameters in R3 it does give the wanted result.
    FUNCTION ZBAPI_CLASS_GET_CLASSIFICATION.
    ""Local Interface:
    *"  TABLES
    *"      OBJECT_CLASSIFICATION STRUCTURE  BAPI_OBJECT_VALUES
    *"      CLASS_OBJECTS STRUCTURE  BAPI_CLASS_OBJECTS
    data ZOBJECT_CLASSIFICATION type TABLE OF BAPI_OBJECT_VALUES.
    data ZCLASS_OBJECTS  type TABLE OF BAPI_CLASS_OBJECTS WITH HEADER LINE.
    ZCLASS_OBJECTS-OBJECT_KEY = '000000000000000085'.
    ZCLASS_OBJECTS-OBJECT_TYPE = 'MARA'.
    Append ZCLASS_OBJECTS.
    CALL FUNCTION 'BAPI_CLASS_GET_CLASSIFICATIONS'
      EXPORTING
        CLASSTYPE                    = '001'
        CLASSNUM                     = 'DSWTEST'
    *   KEY_DATE                     = SY-DATUM
    *   LANGU_ISO                    =
    *   LANGU_INT                    =
    *   CHARACTS_OF_CLASS_ONLY       =
    * IMPORTING
    *   RETURN                       =
      TABLES
        OBJECT_CLASSIFICATION        = ZOBJECT_CLASSIFICATION
        CLASS_OBJECTS                = ZCLASS_OBJECTS
    OBJECT_CLASSIFICATION[] = ZOBJECT_CLASSIFICATION[].
    ENDFUNCTION.
    please advise.
    once again if this should be moved to another forum , add the link please!

    Dear,
    I just debugged my Z-function, after adding all input parameters as in the standard BAPI function.
    All parameters seems to be passed correctly except from the table parameters from
    CLASS_OBJECTS
    So all I_parameters are passed :
    {ZBAPI_CLASS_GET_CLASSIFICATION.I_LANGU_INT} = "EN" and
    {ZBAPI_CLASS_GET_CLASSIFICATION.I_LANGU_ISO} = "EN" and
    {ZBAPI_CLASS_GET_CLASSIFICATION.I_KEY_DATE} = Date (2011, 08, 05) and
    {ZBAPI_CLASS_GET_CLASSIFICATION.I_CLASSNUM} = "DSWTEST" and
    {ZBAPI_CLASS_GET_CLASSIFICATION.I_CLASSTYPE} = "001" and
    {ZBAPI_CLASS_GET_CLASSIFICATION.I_CHARACTS_OF_CLASS_ONLY.BAPIFLAG} = ""
    but the table parameters aren't coming through:
    {ZBAPI_CLASS_GET_CLASSIFICATION.T_CLASS_OBJECTS.OBJECT_TYPE} = "MARA" and
    {ZBAPI_CLASS_GET_CLASSIFICATION.T_CLASS_OBJECTS.OBJECT_KEY} = "000000000000000085" and
    these are 'blanco' in the function.
    also after the function is executed and all data is retrieved, when passing the data back to Crystal reports, once again, the table result isn't passed to Crystal Reports.
    please advise

  • Aggregate Function in a report region does not work.

    I have a Reports Region with a Region Source that contains an aggregate function. But when I run the page, the value of the function is not returned. I suspect it is a simple syntax error. can somebody tell me what is wrong with
    select "TAG_PERIOD_START_DATE", MIN("ORDER_NUMBER")
    from "#OWNER#"."TAG_ORDER"
    group by "TAG_PERIOD_START_DATE"
    order by "TAG_PERIOD_START_DATE"
    The problem is probably with the MIN("ORDER_NUMBER") part. I tried several versions of that, but none worked.
    The Grouping works fine -- the query returns the TAG_PERIOD_START_DATE, just not the value of the function.
    BTW, this query works in SQL Plus (with the quotes removed, of course).
    Thanks for any suggestion you may have.

    When I just made a change to the SQL, I got a message stating:
    You have requested to change the Interactive Report query. If you added columns to the query, they will not be displayed when the report is run. You will need to use the actions menu and either select the columns or click Reset. If you removed any columns from the query, it will disable existing filters, highlight rules, and other report settings referencing those columns. Please confirm your request.
    So maybe that was the cause of the problem yesterday. Where is the "Actions menu"?

  • Calling a Z-Report using a Function Module.

    Hi All,
    Kindly provide me help in: 
    How to call a Z-Report which generates a flat file in the Application server. And which I want to call using a Function Module and display all the fields which are generated in the file.
    Steps I've already done:
    1) I've created a Function Module
    2) Created a structure which I've used in the Tables tab of the FM
    3) Used:
       SUBMIT ZSCOMAR
                    VIA SELECTION-SCREEN
                    USING SELECTION-SET 'Variant'
                   AND RETURN.
    Output whichI'm receiving:
    Only the no. of rows is shown but not the fields individually.
    Thanks in Advance.
    Regards,
    Sreedhar.

    you can either :
    display the data from the ZPROGRAM(by editing it)
    or
    by reading the file again in you FM using open dataset, read dataset, close dataset. and display the content

  • Calling user defined stored FUNCTIONS in report

    Post Author: fahimghauri
    CA Forum: Data Connectivity and SQL
    Hi,
    I want to call database stored functions in report, but when I connect to database using DATABASE EXPERT it shows me tables,view and stored procedures not functions. How can I import/use functions defined in database into my report?
    I am connected with DB2 v9.
    Thanks in advance

    Post Author: Krison
    CA Forum: Data Connectivity and SQL
    other soluce:bring your function in a view and join this view on your request. (Work only for simple return) Sample:CREATE function fn_GetAge ( @i_Name char(10) )    returns SMALLINTBEGIN    declare @o_Age smallint    select @o_Age from Employ where Name = @i_Name     return @o_Age ENDCREATE VIEW dbo.v_UserAgeasSELECT Table2.Username, ISNULL(dbo.fn_GetAge(Table2.Username),0) as Age    FROM Table2 WITH (NOLOCK)GO

  • PL/SQL Table use in report region query

    Hello,
    I have a package function which return pl/sql table. I want to create a report region based on this pl/sql table. Is it possible to do this kind of report in HTMLDB?
    Please guide me in this area.
    Thanks
    HA

    The htmldb_collections API (apec_collections in 2.2) is a very useful method for rendering reports and one I have used extensivly in the past.
    Once created and populated you can reference your collection as if it were a SQL table i.e.
    Select c001, c002, c003
    from htmldb_collections
    where collection_name = 'MY_COLLECTION';
    You can absolutly base an Apex Report region on collections. Just treat them as another table that you can select from, join to others etc.
    In order to utilise this you must do the following:
    1) Create your collection:
    note that collections only persist for the duration of your session and you can only see the data you inserted into the collection. Also I would create this collection as the Database user who owns the Apex Workspace
    htmldb_collection.create_or_truncate_collection ('MY_COLLECTION');
    2) Populate your collection:
    In your case I would set a loop construct that parses through your pl/sql table and assign all values as described below. I assumed that my_plsql_tab has 3 columns called Val1, Val2, Val3
    FOR x IN 1..my_plsql_tab.count
    LOOP
    htmldb_collection.add_member (p_collection_name => 'MY_COLLECTION',
    p_c001 => my_plsql_tab(x).val1,
    p_c002 => my_plsql_tab(x).val2,
    p_c003 => my_plsql_tab(x).val3
    END LOOP;
    Note that you can have upto 60 elements in your collection.
    3) Access your collection:
    Select c001, c002, c003
    from htmldb_collections
    where collection_name = 'MY_COLLECTION';
    This quesry can then form the source of your sql report region.
    Hope all that helps
    Duncan

  • Connecting a report region and a PL/SQL region

    Hi,
    I have created a report region whith pagination that only show 1 row at a time. I can then navigate backwards and forwards through this recordset. The first reportcolum in this recordset contains a number.
    I have also, on the same page, created a PL/SQL procedure region. What I want is to use the number from the SQL region as an input to the PL/SQL region. So when I navigate through the report (Using the pagination arrows), the PL/SQL region is in sync with the record I'm currently seeing in the report.
    Is this possible or do I have to try something different?
    Regards
    Trond

    Hi Trond,
    If you only want to show one record in your first region, it might be best to work with page items, retrieve one record at a time and use that data as the source for your page items. It's easier to implement and easier to reference those values in your second region. Reports are great if you have more then one record.
    Having said that, there are ways to implement it the way you outlined it in your posting. Granted it's not very elegant but it serves its purpose. You could write your own PL/SQL package, use this to set a global to the current row's primary key value and reference that global in your second region.
    Create your package as follows:
    create or replace package md_sample as
    g_pk_value number;
    function set_value(p_value number) return number;
    end;
    create or replace package body md_sample as
    function set_value(p_value in number) return number is
    begin
    g_pk_value := p_value;
    return 1;
    end;
    end;
    Now you need to make sure that your report calls this package appropriately. Calling this as part of your SQL statement won't work properly as it would also be called for records not currently shown on your page. A better way would be to use it for a PL/SQL expression within your report template definition. Pick a custom report template for your report and edit that template. Scroll down to the condition for the first column template and pick “Use Based on PL/SQL Expression”. Then type in the following expression (this is based on a select deptno, dname, loc from dept report):
    md_sample.set_value(#DEPTNO#)=1
    After that you'll be able to reference the global md_sample.g_pk_value. You could e.g. use this as the source for page items shown in your second region.
    Hope this helps,
    Marc

  • Conditional display in a SQL-Report/Report Region

    Hi,
    here I have an example for "Conditional display in a SQL-Report/Report Region". I figured it out in Firefox 3.6.2 using Firebug as development tool on Apex 3.2.1.00.12.
    First you have to put the following javascript code in the Page HTML-Header:
    <script type="text/javascript">
    <!--
    // SOURCE
    // W:\oracle\PRJ DWLS\javascript.07.js
    // Beispiel Funktion zur bedingten Formatierung einer Tabellenzelle.
    // Help (Substitution Strings):
    // http://htmldb.oracle.com/pls/otn/wwv_flow_help.show_help?p_lang=de&p_session=2412201185523196&p_flow_id=4003&p_step_id=420,4003
    // HTML Expression:
    // <script>ex_conditional_td('R094260001010', #ROWNUM#, #COLNUM#-1);</script>#DFT_COND1#
    function ex_conditional_td
    ( p_id
    , p_rownum
    , p_cellnum
      var l_td;
      l_td = vd_getColumn(p_id, p_rownum, p_cellnum);
      // hier die Bedingung definieren
      if (true) {
        l_td.style.color = '#808080';
    }  // -- eof ex_conditional_td -- //
    // Beispiel Funktion zum Abstellen der onMouse Funktionalität der Tabellenzeile
    // HTML Expression:
    // <script>ex_conditional_tr('R094260001010', #ROWNUM#);</script>#DFT_ID#"
    function ex_conditional_tr
    ( p_id
    , p_rownum
      var l_tr;    // TABLE.TR
      var l_td;    // TABLE.TR.TD
      if (true) {
        l_tr = vd_getRow(p_id, p_rownum);
        l_tr.onmouseover = null;
        l_tr.onmouseout  = null;
        for (var i=0; i<l_tr.cells.length; i++) {
          l_td = l_tr.cells;
    l_td.style.backgroundColor = '#DDDDDD';
    } // -- eof ex_conditional_tr() -- //
    var g_DEBUG = false;
    var g_TBODY = null;
    // Liefert das Body-Element der Tabelle mit der ID <p_id>.
    // Parameter
    // p_id - die Id der HTML-Tabelle
    // Return
    // das Body-Element oder NULL, wenn die Zeile nicht gefunden wurde
    function vd_getBody
    ( p_id
    if (g_TBODY == null) {
    var l_table = null;
    l_table = document.getElementById( p_id );
    if (l_table == null) {
    l_table = document.getElementByName( p_id );
    if (l_table != null) {
    if (vd_debug()) {
    alert("Tabelle gefunden, " + l_table.nodeName);
    g_TBODY = vd_search( l_table, 'TD', 't10data', 'TBODY');
    return g_TBODY;
    } // -- eof vd_getBody() -- //
    // Liefert die Zeile <p_rownum> der HTML-Tabelle mit der Id <p_id>.
    // Parameter
    // p_id - die Id der HTML-Tabelle
    // p_rownum - die Zeilennummer
    // Return
    // die Zeile oder NULL, wenn die Zeile nicht gefunden wurde
    function vd_getRow
    ( p_id
    , p_rownum
    var l_body = vd_getBody(p_id);
    if ( l_body != null
    && l_body.nodeName == 'TBODY'
    && l_body.children[p_rownum].nodeName == 'TR') {
    return l_body.children[p_rownum];
    else {
    return null;
    } // -- eof vd_getRow() -- //
    // Liefert die Spalte <p_column> der Zeile <p_rownum> der HTML-Tabelle mit der
    // Id <p_id>.
    // Parameter
    // p_id - die Id der HTML-Tabelle
    // p_rownum - die Zeilennummer
    // p_column - der Index der Spalte / Zelle
    // Return
    // die Zelle oder NULL, wenn die Zelle nicht gefunden wurde
    function vd_getColumn
    ( p_id
    , p_rownum
    , p_column
    var l_tr = vd_getRow(p_id, p_rownum);
    if ( l_tr != null
    && l_tr.nodeName == 'TR'
    && l_tr.children.length >= p_column
    && l_tr.children[p_column].nodeName == 'TD') {
    return l_tr.children[p_column];
    else {
    return null;
    } // -- eof vd_getColumn() -- //
    // Rekursives Suchen nach einem Node.
    // Zweck: Das bedingte Formatieren einer Tabellenzelle in einem Apex Standard
    // SQL-Report.
    // Diese Funktion durchsucht rekursiv, ab einem Ausgangsknoten <p_node>, alle
    // darunter befindlichen Elemente, ob in dem Element <p_seachIn> sich die
    // Klasse <p_class> befindet.
    // Bei Standard-Reports ist die Reportzelle (TD) mit der Klasse
    // "t10data" formatiert.
    // Zunächst muss dazu die Tabellenzelle (TD) selbst, die übergeordnete
    // Tabellenzeile (TR), der Tabellenbody (TBODY) oder die Tabelle (TABLE)
    // selbst ermittelt werden.
    // Der Beispielaufruf:
    // var l_body;
    // var l_node = document.getElementById( 'R112233' );
    // l_body = search( l_node, 'TD', 't10data', 'TBODY');
    // durchsucht also das mit der Id "R112233" versehene Element [der Report, für
    // den in Apex eine statischen ID vergeben werden musste] rekursiv, bis er
    // die [erste] Tabellenzelle "TD" findet, die als Klasse "t10data"
    // definiert hat. Für diese ermittelt er dann das übergeordnete TBODY-Element.
    // Parameter
    // p_node - das Ausgangselement
    // p_searchIn - der Knotenname, der durchsucht werden soll
    // [node.nodeName == p_searchIn]
    // p_class - der Name der CSS Klasse
    // [node.classList[<index>] == p_class
    // p_parentName - der Name [node.parentNode.nodeName == p_parentName]
    // des Elements, das zurückgeliefert werden soll. Wird als
    // p_parentName der Suchname p_searchIn angegeben, wird
    // das Element selbst zurückgegeben.
    // Return
    // das per p_parentName gesuchte Element (TD, TR, TBODY, TABLE)
    function vd_search
    ( p_node
    , p_searchIn
    , p_class
    , p_parentName
    var LN = "vd_search";
    var l_element = null;
    // DEBUG
    if (vd_debug()) {
    alert(LN + ":" + "Untersuche " + p_node.nodeName + ", id=" + p_node.id);
    // 1) der aktuelle Knoten ist der, der durchsucht werden soll
    if (p_node.nodeName == p_searchIn) {
    if (p_node.classList.length > 0) {
    for(var c=0; c<p_node.classList.length; c++) {
    if (p_node.classList[c] == p_class) {
    // Parent Node dynmisch suchen
    l_node = p_node;
    if (l_node.nodeName == p_parentName) {
    return l_node;
    while(l_node != null && l_node.parentNode != null) {
    if (l_node.parentNode.nodeName == p_parentName) {
    return l_node.parentNode;
    else {
    l_node = l_node.parentNode;
    // 2) wenn nicht 1) oder nicht in 1) gefunden, dann in den Kindelementen
    // weitersuchen
    if (p_node.children.length > 0) {
    var i = 0;
    while (i<p_node.children.length && l_element==null) {
    l_element = vd_search( p_node.children[i], p_searchIn, p_class, p_parentName);
    i++;
    return l_element;
    } // -- eof vd_search() -- //
    // Gibt an, ob Debug ein- (true) oder ausgeschaltet (false) ist.
    // Return
    // true - debug ist eingeschaltet
    // false - debug ist ausgeschaltet
    function vd_debug()
    return g_DEBUG;
    -->
    </script>
    Maybe you have to modify the "vd_getBody" function. I'm searching the table cell with having the class "t10data". When you use another theme, there's maybe another class used.
    Second is, that you set an static id for your report region. I prefer this structure:
    R<app-id><page-id><seq> (Raaaaappppsss) e.g. R094260001010.
    First example is to turn off the onMouse-Effect. Maybe on the first or last column definition you put this code in the "HTML-Expression" area:
    <script>ex_conditional_tr('R094260001010', #ROWNUM#);</script>#ID#This will call the example function ex_conditional_tr with the parameter
    a) the region id
    b) the rownum (as oracle always starts with 1 this is the first data row [rownum=0 is the table header row])
    Second example is the conditional formatting of a table cell. Put this in the HML-Expression area:
    <script>ex_conditional_td('R094260001010', #ROWNUM#, #COLNUM#-1);</script>#ENAME#This will call the example function ex_conditional_tr with the parameter
    a) the region id
    b) the rownum
    c) the cellnum (here we have to subtract 1 to get the "real" cell index)
    The "ex_conditional" functions are just a representation of how to get the row or cell node.
    Hope this help a bit.
    Tom

    I would use a CASE statement in the select....
    each CASE would be an img src tag for a different button if the button is an image.
    does that make sense? I can include an example if you would like...

  • Export to Excel from Report region (pl/sql returning sql query)

    Hello all,
    I have encountered an interesting problem. I have an HTMLDB application with a lot of sql reports coded straight inside the report region. In order to better organize my reports, I decided to
    1. make all my report regions of type "Pl/Sql function returning SQL query"
    2. create a package inside my database schema which houses all reports as pl/sql functions returning VARCHAR2, the string returned being the report query
    3. just calling "return package_name.function_name" from inside my report region of type "Pl/sql function returning SQL query".
    This technique seemed to work perfectly. The reports were being returned as expected. I was then asked to provide the "Export to Excel" capability to all my reports. This seemed like a piece of cake using HTML DB's "Export to Excel" extension. However, the "export to excel" does not function correctly when my reports are inside a package in the database. HTML DB tries to export but inside the excel spreadsheet, instead of seeing row data, I see:
    <pre>failed to parse SQL query:
    ORA-00936: missing expression
    <!-- select a.username, b.table_name, 'View Row Data' from schema_browser_user_list a, all_tables b where a.user_id = and a.username = b.owner order by b.table_name asc
    --!>
    </pre>
    I am building my query string inside of my package functions by using a combination of literal strings and concatenating them with some parameter values being passed in. It seems that the HTML DB engine which exports the report to excel does not properly understand the concatenation of variables as can be seen by the empty space to the right of the equal sign in the "a.user_id = " clause. Does anybody have any input as to whether this is a known issue or if I am doing something wrong? Thanks a lot for your time.
    - Kenny R.

    James,
    Thanks for the quick reply. I think you mis-understood what I'm doing. All I'm doing is creating packaged functions which return VARCHAR2. The VARCHAR2 that they return is the report query. With this technique, I no longer have to type the query into the HTML DB report region. Instead, I make the report region a "Pl/sql function returning sql query" and make the following call: return package_name.function_name(some_application_items passed in as parameters)
    This makes for a much more organized html db app. The problem is that the "export to excel" function does not correctly interpret the VARCHAR2 that my packaged functions are returning. Is this a better explanation? Thanks again for your time.
    - Kenny R.

  • Report region runs very slow, but its sql runs fast

    We have a page with a report region Type :SQL Query (plsq function body returning sql query) which runs very slow, pegging the tach on our db box for almost a minute before returning report rows. However, if we run the generated sql from sql plus, it returns all the rows in under 10 seconds with nary a blip on the box. Any idas how what could be causing this or how to debug?
    Thanks,
    Steve

    OK, here is the bad boy, shortly after our code that returns the data.
    declare
    rc__ number;
    simple_list__ owa_util.vc_arr;
    complex_list__ owa_util.vc_arr;
    begin
    owa.init_cgi_env(:n__,:nm__,:v__);
    htp.HTBUF_LEN := 63;
    null;
    null;
    simple_list__(1) := 'sys.%';
    simple_list__(2) := 'dbms\_%';
    simple_list__(3) := 'utl\_%';
    simple_list__(4) := 'owa\_%';
    simple_list__(5) := 'owa.%';
    simple_list__(6) := 'htp.%';
    simple_list__(7) := 'htf.%';
    simple_list__(8) := 'wpg_docload.%';
    if ((owa_match.match_pattern(p_string =>
    'f'
    /* */,p_simple_pattern =>
    simple_list__
    ,p_complex_pattern =>
    complex_list__
    ,p_use_special_chars =>
    false)))
    then
    rc__ := 2;
    else
    null;
    null;
    f(p=>:p);
    if (wpg_docload.is_file_download) then
    rc__ := 1;
    wpg_docload.get_download_file(:doc_info);
    null;
    null;
    null;
    commit;
    else
    rc__ := 0;
    null;
    null;
    null;
    commit;
    owa.get_page(:data__,:ndata__);
    end if;
    end if;
    :rc__ := rc__;
    end;
    call count cpu elapsed disk query current rows
    Parse 0 0.00 0.00 0 0 0 0
    Execute 1 25.53 26.59 4492 20992 60 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 1 25.53 26.59 4492 20992 60 1

  • SQL Report Region Refresh

    Application Express 4.0.2.00.09
    Oracle 11 XE
    How do I setup a Dynamic Action to refresh my region every X number of seconds? I can refresh the region easy enough on events, but I can't seem to figure out the timing thing. Maybe I just need some sleep...
    Austin

    Joe -
    Interestingly enough, I have not yet found a good way to alter the Report Region title with the last update time. I would think there is a way to do it, but I do not currenlty have that knowledge, nor the time to thoroughly investigate how to do it. I do have a bit to share about the mechanics of the refresh discussed earlier in this thread.
    Consider this code, place in the footer of a SQL Report Region:
    <script type="text/javascript">
    <!--
      var d = new Date();
      document.write("Last Updated: " + d);
      setInterval("jQuery('#INTRADAY_IRR').trigger('apexrefresh');", 2000);
    -->This will place the date as a footer to the SQL report. The javascript will then refresh the report every two seconds. (or whatever timeframe you specify) Now, in my SQL for my report, I added an additional column that is the current time. My SQL would look something like:
    SELECT foo,
            bar,
            to_char(sysdate, 'HH24:MI:SS') update_time
    FROM dualThis SQL will show when the data was last fetched from the database, while the footer of the region shows the time when the region was loaded by the browser.
    If you run the page with these, or similar, parameters, you will notice that the update_time column in the report changes with each refresh, however, the region footer does not change. This is because the script isn't called everytime the data is refreshed. This would indicate that using the methodology mentioned previously in this thread, the entire region is not refreshed but simply the dataset and the report itself. This would mean that you would have a quite difficult time updating the region title from the SQL code alone... I'm not saying it is impossible, I just don't know how to do it...
    Having said that- I do have a work around.
    Consider this as the region title:
    <div id="MyUpdatedReport" ></div>Now consider this code in the region header:
    <script type="text/javascript">
    function getUpdatedDate() {
      var d = new Date();
      document.getElementById('MyUpdatedReport').innerHTML="Region Title - Last Updated: " + d;
      t=setTimeout('getUpdatedDate()',2000);
    </script>And this in the region footer:
    <script type="text/javascript">
    <!--
      setInterval("jQuery('#INTRADAY_IRR').trigger('apexrefresh');", 2000);
      getUpdatedDate();
    -->
    </script>We create a DIV tag as our header. Then we have a function in the header that updates our div tag every two seconds. In the footer, we tell APEX to refresh the data every two seconds, and we tell our function to begin working. Effectively, you have a timestamp indicating when, theoretically, the data should have been refreshed. Now, this timestamp in the Region Title is NOT the true update time, but, theoretically it should be close. You should probably test this to see if you want to use it. Personally, I don't like this solution and I don't think I would ever implement it in any sort of production application. However, in an application that is just for me, I might hack something like this up.
    The key part of this work around would be to keep your times synchronized. It would be of no benefit if APEX was refreshing the data every 60 seconds but the title was refreshing every 6 seconds. Yikes, that could confuse a few people.
    I hope this has been a help.
    Austin

Maybe you are looking for