Saving checkbox-state to table in Interactive Report

Hi,
I have been working with the information on http://www.apexninjas.com/blog/wp-content/uploads/2012/03/Checkboxes_in_Interactive_Reports.pdf to create an interactive report with a column containing a checkbox for each row.
My report contains the following (simplified):
Task_id, Employee_id, Checkbox_column
The checkbox_column keeps track of which employees work on which tasks, so it could be:
Task_id, Employee_id, Checkbox_column
1               1                         0
1               2                         1
1               3                         0
signifying that only employee 2 works on task 1.
Now, I need to be able to change the 0 to 1 by clicking the checkbox, which already is possible, but I have problems saving that row to the database. Saving the checkbox state is also included in the PDF I used (page 12-14, 'Saving the checkbox state #2'), but I don't really understand where to put the scripts, I haven't worked with scripts and processes before so I could use some help understanding which script I need to put where. All in all, it's not too much code, I just don't understand where to put it.
The scripts mentioned in the PDF are:
The first one is a SQL-statement or a package, I imported the package in my environment, so I won't put the SQL here
This is the only one I know where to put:
<script type="text/javascript">
function getCurIRTab()
var temp_base_report_id = $v('apexir_report_id');
return temp_base_report_id;
</script>
This I don't know where to put:
<script type="text/javascript">
document.getElementById('P_IR_REPORT_ID').value = getCurIRTab();
</script>
the PDF says:
Now, create a hidden (just hidden, not protected!) item called P_IR_REPORT_ ID inside a HTML region.
Important! This region has to be rendered afterthe Interactive Report, so create it in the “after footer” display point!
In this regions’s footer paste the following JavaScript code, that will assign the hidden item P_IR_REPORT_ID the value of the Interactive Report ID.
But can we create a region in the after footer?
This I don't know where to put because the document doesn't specify it:
apex_ir_query.ir_query_where
(:APP_ID,--application id
99,--page id
:SESSION,--sesion ID
: P_IR_REPORT_ID -–interactive report ID);
This I don't know where to put, but I guess it's a 'processing' process:
declare
whereStmt varchar2(2000);
sqlStmt varchar2(2000);
begin
whereStmt := apex_ir_query.ir_query_where(:APP_ID,
99,
:SESSION,
:P_IR_REPORT_ID);
sqlStmt := 'update CHK_TEST set SELECTED = 0 where SELECTED= 1'||whereStmt;
execute immediate sqlStmt;
if APEX_APPLICATION.G_F01.COUNT>0 then
FOR i in 1..APEX_APPLICATION.G_F01.COUNT LOOP
update CHK_TEST
set VALID_LINE = 1
where SELECTED_ID = APEX_APPLICATION.G_F01(i)
and VALID_LINE = 0;
END LOOP;
end if;
end;
Can I please get some help understanding where exactly to put these scripts?
I've been looking around on the forum and Google but I can't find the detailed answer to what I'm looking for anywhere.
I am currently working with the test environment Oracle supplied us, because we are testing if we can use APEX at our company.
The version is Application Express 4.2.2.00.11 and it's running on Oracle 11g.
Just ask if you need any more info.
Thanks for the answers!
NDG

Please put together an example application on apex.oracle.com and provide developer credentials.  This would help prevent multiple posts back and forth about try this, try that, now try this, now try that......
But until you do that try this:
I think you already know that the following goes in the page html header.
<script type="text/javascript">
function getCurIRTab()
var temp_base_report_id = $v('apexir_report_id');
return temp_base_report_id;
</script>
Alternately, since you are on apex 4.2 you could just add it to the Page Attributes->JavaScript->Function and Global Variable Declaration field (without the script tags):
function getCurIRTab()
var temp_base_report_id = $v('apexir_report_id');
return temp_base_report_id;
Now you need to create an HTML region (in display point "after footer").  Then you create the P_IR_REPORT_ID hidden item inside your new region.
In the region definition you will put the following code into the region footer:
<script type="text/javascript">
document.getElementById('P_IR_REPORT_ID').value = getCurIRTab();
</script>
Alternately, you could try to add the line to the Page Attributes->JavaScript->Execute when Page Loads field:
document.getElementById('P_IR_REPORT_ID').value = getCurIRTab();
This is just an example of the procedure call you will make in your page process.
apex_ir_query.ir_query_where
(:APP_ID,--application id
99,--page id
:SESSION,--sesion ID
: P_IR_REPORT_ID -–interactive report ID);
It is included in this code which you will put into a page process.
declare
whereStmt varchar2(2000);
sqlStmt varchar2(2000);
begin
whereStmt := apex_ir_query.ir_query_where(:APP_ID,
99,
:SESSION,
:P_IR_REPORT_ID);
sqlStmt := 'update CHK_TEST set SELECTED = 0 where SELECTED= 1'||whereStmt;
execute immediate sqlStmt;
if APEX_APPLICATION.G_F01.COUNT>0 then
FOR i in 1..APEX_APPLICATION.G_F01.COUNT LOOP
update CHK_TEST
set VALID_LINE = 1
where SELECTED_ID = APEX_APPLICATION.G_F01(i)
and VALID_LINE = 0;
END LOOP;
end if;
end;
Ok, clear as mud!

Similar Messages

  • Tabular form validation(Checkbox) is not working for Interactive report

    Hi,
    I am using the oracle apex 4.0 and oracle 11g.
    I have written a below select query on interactive report as
    select
    apex_item.checkbox(1,RESIDD)||apex_item.hidden(2,RESIDD) row_selector,
    apex_item.text(3,RESNUM) as resnum
    from "PDRRES"
    and written the validation to display the error message( Function returning error text ) as
    DECLARE
    vRow BINARY_INTEGER;
    BEGIN
    -- apex_application.g_print_success_message := NULL;
    FOR i IN 1 .. apex_application.g_f01.COUNT
    LOOP
    vRow := apex_application.g_f01(i);
    apex_application.g_print_success_message := apex_application.g_f01(i)||'-'|| apex_application.g_f03(vRow) ;
    END LOOP;
    END;
    Output : No data found error message
    As far as it work for sql report with above logic because apex built in row selector
    but it fails in case of interactive report for some reason.
    Please suggest.

    Saroj Nayak wrote:
    Hi,
    I am using the oracle apex 4.0 and oracle 11g.
    I have written a below select query on interactive report as
    select
    apex_item.checkbox(1,RESIDD)||apex_item.hidden(2,RESIDD) row_selector,
    apex_item.text(3,RESNUM) as resnum
    from "PDRRES"
    and written the validation to display the error message( Function returning error text ) as
    DECLARE
    vRow BINARY_INTEGER;
    BEGIN
    -- apex_application.g_print_success_message := NULL;
    FOR i IN 1 .. apex_application.g_f01.COUNT
    LOOP
    vRow := apex_application.g_f01(i);
    apex_application.g_print_success_message := apex_application.g_f01(i)||'-'|| apex_application.g_f03(vRow) ;
    END LOOP;
    END;
    Output : No data found error message
    As far as it work for sql report with above logic because apex built in row selector
    but it fails in case of interactive report for some reason.
    Please suggest.NO DATA FOUND usually occurs when an i mplicit select does not find anything. It can also occur when referencing a collection element that has not been defined.
    You have 2 collectinons in the code you posted, apex_application.g_f01() and apex_applciation.g_f03. Since you are looping therough the COUNT attribute of g_f01 its reference ("I") is probably okay and the value store in vRow is probably not right. You can check this by using RAISE_APPLICTION_ERROR to see the value something like
    raise_application_error(-20000,'vRow="'||vRo2||'"');Remember that working with checkboxes is tricky. If the box is not checked nothing will be sent. You may need to define a default value when no value is submitted.

  • How to combine three tables in interactive report in apex

    Hi All,
    How to display the below Query in interactive report apex!!
    select distinct market d, marketid r from (
    select market, marketid,p.productid, h.hubid, s.begin_date, s.stripname
    from d_st s, d_ma x, d_hu h, d_pro p
    where s.ice_strip_id=x.ice_strip_id
    and x.baseproductid=p.productid
    and x.hubid=h.hubid
    and h.hubid=nvl(:P2__HUBID,-2)
    and p.productid=nvl(:P2__PRODUCTID,-2))g
    order by 2
    Thanks,
    Anoo..

    just paste your query into the source field of the interactive report.. thats it.

  • How to use dynamic internal table in interactive report syntax

    pls let me know

    Hi Aarif,
    Go through the below code for better understanding:
    *& Report  ZDYN_INT_TABLE_02                                           *
    REPORT  ZDYN_INT_TABLE_02.
    TYPE-POOLS: slis.                      " ALV Global types
    SELECTION-SCREEN BEGIN OF BLOCK b1.
    PARAMETERS : p_max(3) TYPE n OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    TYPES: BEGIN OF wa_gt_data,
              matnr TYPE mara-matnr,
           END OF wa_gt_data.
    DATA gt_data TYPE STANDARD TABLE OF wa_gt_data WITH HEADER LINE.
    *INITIALIZATION.
    v_1 = 'Maximum of records to read'.
    START-OF-SELECTION.
      PERFORM f_read_data.
      PERFORM f_display_data.
         Form  f_read_data
    FORM f_read_data.
      SELECT matnr INTO TABLE gt_data
               FROM mara
                 UP TO p_max ROWS.
    ENDFORM.                               " F_READ_DATA
         Form  F_DISPLAY_DATA
    FORM f_display_data.
      DATA:
        l_column    TYPE sy-tabix,
        lp_struct   TYPE REF TO data,
        lp_table    TYPE REF TO data,      " Pointer to dynamic table
        ls_lvc_cat  TYPE lvc_s_fcat,
        lt_lvc_cat  TYPE lvc_t_fcat,       " Field catalog
        lt_fcat     TYPE slis_t_fieldcat_alv,  " Field catalog
        ls_fieldcat TYPE slis_fieldcat_alv,
        lt_fieldcat TYPE slis_t_fieldcat_alv,  " Field catalog
        ls_layout   TYPE slis_layout_alv.
      FIELD-SYMBOLS :
        <header>       TYPE ANY,
        <field_header> TYPE ANY,
        <field_mara>  TYPE ANY,
        <lt_data>      TYPE table.         " Data to display
      ls_lvc_cat-fieldname = 'COLUMNTEXT'.
      ls_lvc_cat-ref_table = 'LVC_S_DETA'.
      APPEND ls_lvc_cat TO lt_lvc_cat.
      ls_fieldcat-fieldname = 'COLUMNTEXT'.
      ls_fieldcat-ref_tabname = 'LVC_S_DETA'.
      ls_fieldcat-key  = 'X'.
      APPEND ls_fieldcat TO lt_fieldcat.
      DO p_max TIMES.
      For each line, a column 'VALUEx' is created in the fieldcatalog
      Build Fieldcatalog
       WRITE sy-index TO ls_lvc_cat-fieldname LEFT-JUSTIFIED.
        CONCATENATE 'VALUE' ls_lvc_cat-fieldname
               INTO ls_lvc_cat-fieldname.
        ls_lvc_cat-ref_field = 'VALUE'.
        ls_lvc_cat-ref_table = 'LVC_S_DETA'.
        APPEND ls_lvc_cat TO lt_lvc_cat.
      Build Fieldcatalog
        CLEAR ls_fieldcat.
        ls_fieldcat-fieldname = ls_lvc_cat-fieldname.
        ls_fieldcat-ref_fieldname = 'VALUE'.
        ls_fieldcat-ref_tabname = 'LVC_S_DETA'.
        APPEND ls_fieldcat TO lt_fieldcat.
      ENDDO.
    Create internal table
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = lt_lvc_cat
        IMPORTING
          ep_table        = lp_table.
      ASSIGN lp_table->* TO <lt_data>.
    Create structure = structure of the internal table
      CREATE DATA lp_struct LIKE LINE OF <lt_data>.
      ASSIGN lp_struct->* TO <header>.
    Create field catalog from dictionary structure
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'MARA'
        CHANGING
          ct_fieldcat            = lt_fcat
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      LOOP AT lt_fcat INTO ls_fieldcat WHERE fieldname = 'MATNR'.
        ASSIGN COMPONENT 1 OF STRUCTURE <header> TO <field_header>.
        IF sy-subrc NE 0. EXIT .ENDIF.
        READ TABLE lt_fcat INTO ls_fieldcat INDEX sy-index.
        <field_header> = ls_fieldcat-seltext_m.
        IF <field_header> IS INITIAL.
          <field_header> = ls_fieldcat-fieldname.
        ENDIF.
        LOOP AT gt_data.
          l_column = sy-tabix + 1.
          ASSIGN COMPONENT 1 OF STRUCTURE gt_data TO <field_mara>.
          IF sy-subrc NE 0. EXIT .ENDIF.
          ASSIGN COMPONENT l_column OF STRUCTURE <header> TO <field_header>.
          IF sy-subrc NE 0. EXIT .ENDIF.
          WRITE <field_mara> TO <field_header> LEFT-JUSTIFIED.
        ENDLOOP.
        APPEND <header> TO <lt_data>.
      ENDLOOP.
      ls_layout-colwidth_optimize = 'X'.
      ls_layout-no_colhead = 'X'.
      ls_layout-zebra = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          is_layout   = ls_layout
          it_fieldcat = lt_fieldcat
        TABLES
          t_outtab    = <lt_data>.
    ENDFORM.                               " F_DISPLAY_DATA
    END OF PROGRAM Z_ALV_LIST_TRANSPOSED *********************
    *Always reward point for helpful answers
    Regards,
    Amit

  • Formating column in Pivot Table (Hyperion Interactive Reporting 9.3.1)

    I have a simple pivot table with multiple columns (8) and I have 6 different pivots. I drag the pivots into the report section, but none of the column widths or row heights align properly.
    How do you size the column widths in each pivot and I'm trying to avoid auto-size because that does not get it right.
    Thanks,

    The 6 pivots are different because the rows indicate something entirely different. for example:
    Pivot 1:
    Row Label: Customer Gender
    Column Label: Quarters (1-4)
    Facts: Sales
    Pivot 2.
    Row Label: Customer ethnicity
    Column Label: Quarters (1-4)
    Facts: Sales
    Pivot 3.
    Row Label: Customer Age group
    Column Label: Quarters (1-4)
    Facts: Sales
    Pivot 4.
    Row Label: Customer City
    Column Label: Quarters (1-4)
    Facts: Sales
    Then I grab each pivot and drag them into the report section to create 1 report.
    A better solution?

  • Interactive Report - Save Default Filter not Saving

    In Apex 3.2 I have an Interactive report were a Filter I applied won't save to the report.
    I applied the Filter and saved it as the default report for all users, but when I leave the page and come back the filter its gone.
    The same application on different pages has interactive report with filters applied to the default report and they all work fine, it's just this one report that the filter won't stay.
    First time I've every had this issue.
    Any ideas?
    The filter is pretty simply, I have a column that has codes of D, E, G,... and I apply the filter for CODE != D.

    Hi,
    I've just been trying the "in the last" option and had no problems for any number that I entered. Are you just entering 1 into the box? What error do you get?
    I've loaded the page with Debug switched on, and get:
    select
           null as apxws_row_pk,
           "DATE_ID",
           "ATD_DATE",
           "CHECK",
           count(*) over () as apxws_row_cnt
    from (
    select  *  from (
    select
    apex_item.checkbox(1, DATE_ID) "CHECK",
    "DATE_ID",
    "ATD_DATE"
    from "#OWNER#"."ATD_DATES"
    )  r
    where ("ATD_DATE" between systimestamp - (1 * :APXWS_EXPR_1) and systimestamp)
    ) r where rownum <= to_number(:APXWS_MAX_ROW_CNT):APXWS_EXPR_1 would contain the value 1 as that is what I've entered for the filter. My report's sql statement is just the innermost nested select statement, the rest has been added by the IR functionality and the filter.
    Andy

  • Dynamic Checkboxes on Interactive Report

    I have an interactive report that currently lists a row of values:
    Field1
    Val1
    Val2
    Val3
    I would like to place a text-field at the top of this interactive report with a submit button:
    [textbox] [submit button]
    Field 1
    Val1
    Val2
    Va3
    Then I would like to have checkboxes [] appear in each row:
    [textbox] [submit button]
    Field1 | Checkbox
    Val1 | []
    Val2 | []
    Val3 | []
    Then I would like to make it so that the user enters some text into the textbox and selects any number of the row checkboxes. Upon hitting submit, a procedure will run that accepts each Field1 value and inserts a record into a table containing 2 fields: the Field1 value and the textbox text.
    So the following user input:
    [Test text in the textbox.] [submit button]
    Field1 | Checkbox
    Val1 | []
    Val2 | [x]
    Va3 | [x]
    After hitting the submit button, a procedure would be called that would insert 2 records into a table:
    Field1 | Field2
    Val2 | Test text in the textbox.
    Val3 | Test text in the textbox.
    Note that there is no entry for Val1 because its checkbox was not checked when the user pressed submit.
    What can I do to make this happen? I appreciate any help you can offer.

    Thanks for sharing
    I am having exactly the same problem.
    I have an interactive report with the following SQL.
    select RSN_CD,
        DESC,
    APEX_ITEM.CHECKBOX(1,RSN_CD) "Select"
    from CAN_RSN
    I've set the 'Select' column's type to 'Standard Report Column'.  But the checkbox does not appear on the report. 
    Apex Version: 4.0.1.00.03
    Thanks.

  • Interactive report with checkbox and editable field

    Hi,
    For a project I'm working on I need to create a interactive report in Apex 3.2 with the ability to select lines and to modify one of the columns in the report.
    To do this, I started off by adding these two fields to the selection query of my IR:
    apex_item.checkbox(1, product_number) cb
    and
    apex_item.text (2,QTY_TO_ORDER) QTY_TO_ORDER
    cb is the checkbox files, and QTY_TO_ORDER is the editable field.
    That worked like a charm and I got my two fields in the report.
    To process the values, I added this page process, wich for now should only store the "product number" and "QTY_TO_ORDER" fields in a table.
    BEGIN
    FOR i in 1..APEX_APPLICATION.G_F01.count LOOP
    insert into mytmptable values (APEX_APPLICATION.G_F01(i),APEX_APPLICATION.G_F02(i));
    END LOOP;
    commit;
    end;
    However, this doesn’t work the way I want it to work. When I check the checkboxes of two rows, it will store two rows with the right product numbers, but it will take the top two QTY_TO_ORDER field of the table regardless of which ones are checked. I was able to solve this problem, by adding a rownum to the query and using the rownum as the value for the checkbox. Since I still need the product_number and qty_to order fields I made them both text fields.
    I changed my page process to:
    BEGIN
    FOR i in 1..APEX_APPLICATION.G_F01.count LOOP
    insert into mytmptable values (APEX_APPLICATION.G_F02(APEX_APPLICATION.G_F01(i)),
    APEX_APPLICATION.G_F03(APEX_APPLICATION.G_F01(i)));
    END LOOP;
    commit;
    end;
    This seemed to solve the problem, and I now got the right values in the table, unless I used sorting in the report... As soon as I sorted the report in a way different than by rownum, I got the wrong values in the table. The reason for this is of course that my insert just selects the nTh row from the table, and my rownums aren't dynamic.
    I've found a lot of examples on the internet using '#ROWNUM#' in the selection, which should dynamically generate a rownum in the report. This seems to work in normal report, but in a interactive reports, the literal values '#ROWNUM#' shows up.
    Is there any way to solve this issue?

    Hi,
    Try with 3 fields:
    apex_item.checkbox(1, product_number) cb,
    apex_item.text (2,QTY_TO_ORDER) QTY_TO_ORDER,
    apex_item.hidden(3, product_number) prod_no
    The hidden field should be display as a hidden column.
    Then your process can be:
    BEGIN
    FOR i in 1..APEX_APPLICATION.G_F01.count LOOP
    FOR j in 1..APEX_APPLICATION.G_F03.count LOOP
    IF APEX_APPLICATION.G_F01(i) = APEX_APPLICATION.G_F03(j)) THEN
    insert into mytmptable values (APEX_APPLICATION.G_F01(i),APEX_APPLICATION.G_F02(j));
    exit;
    END IF;
    END LOOP;
    END LOOP;

  • Using Interactive Report with SQL query accessing tables via db link

    Is there a known issue with using the interactive report in version 3.1.2.00.02 with SQL that is accessing tables via a database link? I get the error 'not all variables bound', I do not get this error when using the standard report for the same SQL?
    Thanks,
    Edited by: [email protected] on May 26, 2009 2:59 PM

    Varad,
    Good question, failed to check that. In fact there are errors. Dump file c:\oraclexe\app\oracle\admin\xe\bdump\xe_s002_3640.trc
    Mon Jun 15 08:48:11 2009
    ORACLE V10.2.0.1.0 - Production vsnsta=0
    vsnsql=14 vsnxtr=3
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    Windows XP Version V5.1 Service Pack 3
    CPU : 2 - type 586, 1 Physical Cores
    Process Affinity : 0x00000000
    Memory (Avail/Total): Ph:1051M/2038M, Ph+PgF:2273M/3934M, VA:1302M/2047M
    Instance name: xe
    Redo thread mounted by this instance: 1
    Oracle process number: 16
    Windows thread id: 3640, image: ORACLE.EXE (S002)
    *** ACTION NAME:(PAGE 2) 2009-06-15 08:48:11.743
    *** MODULE NAME:(APEX:APPLICATION 112) 2009-06-15 08:48:11.743
    *** SERVICE NAME:(SYS$USERS) 2009-06-15 08:48:11.743
    *** CLIENT ID:(ADMIN:232384011651572) 2009-06-15 08:48:11.743
    *** SESSION ID:(24.931) 2009-06-15 08:48:11.743
    *** 2009-06-15 08:48:11.743
    ksedmp: internal or fatal error
    ORA-07445: exception encountered: core dump [ACCESS_VIOLATION] [_LdiDateFromArray+55] [PC:0x608B04F3] [ADDR:0x0] [UNABLE_TO_WRITE] []
    Current SQL statement for this session:
    select Stage,Procedure,Stp,FW,Reslt,MSG,date_run
    from bi_msg_VW@dwitnm
    order by 1
    ----- PL/SQL Call Stack -----
    object line object
    handle number name
    2FE1EA14 1207 package body SYS.DBMS_SYS_SQL
    2FE1F064 328 package body SYS.DBMS_SQL
    2ABDC520 5097 package body APEX_030200.WWV_RENDER_REPORT3
    2BD5E55C 1538 package body APEX_030200.WWV_FLOW_DISP_PAGE_PLUGS
    2BD5E55C 366 package body APEX_030200.WWV_FLOW_DISP_PAGE_PLUGS
    335BDA88 11190 package body APEX_030200.WWV_FLOW
    2BDBD1C8 255 procedure APEX_030200.F
    2AB58D10 30 anonymous block
    ----- Call Stack Trace -----
    I didn't include the call stack, it is too large. Now I'm even more puzzled that the IR would work while a sql report would fail.
    Bob

  • Interactive Report with html tags --- Data saved in Excel with html tags

    Hello,
    I am using APEX 4.0. I have an interactive report that displays some of the columns bold and / or colors using html tags. As an example,
    SELECT
    '''<font color="green"><b>'' || SERIAL_NUMBER || ''</b></font>'' SERIAL_NUMBER,'||chr(10)||
    'PRODUCT_NAME,'||chr(10)||
    '''<font color="teal"><b>'' || PRODUCT_DESC || ''</b></font>'' DESC,'||chr(10)||
    'QUANTITY,'||chr(10)||
    FROM
    <Table name>
    At runtime, the Interactive Report displays the fonts, colors correctly; however, when I save the data of the Interactive Report in an Excel format, it saves the Html tags along in the EXCEL spreadsheet. For example, the column serial number from the above SELECT statement is extracted in an Excel column as ---
    <font color="green"><b>123456789</b></font>
    Is there another way to render the column data so that extracted data will not display the HTML tags or is removing the html font color tags from the SELECT statement the only option?
    Thanks in advance.
    Ed

    Hello,
    I have a feeling all your problems are related take a look at this thread. I found it in 10 seconds of searching the forum.
    strange tags
    It's always best to do a quick search first most likely you are not the first person to have this problem.
    Carl

  • SQL statement with Function returns slow in Interactive Report

    I have an Interactive Report that returns well but when I add in a function call in the where clause that does nothing but return a hard coded string of primary keys and is compared to a table's primary key with a like operator the performance tanks. Here is the example:
    get_school2_section(Y.pk_id,M.pk_id,I.section,:P577_SECTION_SHUTTLE) LIKE '%:' || I.pk_id || ':%'
    I have the values hard coded in the return of the function. There are no cursors run in the function, there is no processing done in the function. It only declares a variable. Sets the variable, and returns that variable back to the SQL statement.
    I can hard code the where clause value to look like this:
    ':90D8D830A877CCFFE040010A347D1A50:8ED0BBFDEAACC629E040010A347D6471:9800B8FDBD22B761E040010A347D0D9A:' LIKE '%:' || I.pk_id || ':%'
    This returns fast. When I add in the function call which returns the same hard coded values, the page goes from returning in 1 to 2 seconds to 45 or more seconds.
    Why does adding a simple function call into the where clause cause such a deterioration in performance.
    Edited by: alamantia on Aug 17, 2011 7:39 AM
    Edited by: alamantia on Aug 17, 2011 7:40 AM

    So you are telling me that the where clause with a function call will NOT run the function on every row? Please explain that to me further?
    if you have code that is the following:
    select a,b,c from a_table where a > 2 and b < 3 and function_call(c) > 0You are telling me that Oracle will NOT call that function on EVERY row it tries to process in the select?
    Thank you,
    Tony Miller
    Webster, TX
    I cried because I did not have an office with a door until I met a man who had no cubicle.
    -Dilbert
    If this question is answered, please mark the thread as closed and assign points where earned..

  • Interactive report--hide statement?

    hi
    I am making an interactive report,but my hide statement is not working.my code is like:
    START-OF-SELECTION.
      SELECT matnr
             mtart
             matkl
      INTO CORRESPONDING FIELDS OF TABLE itab1
      FROM mara  WHERE matnr IN p_matnr.
      WRITE:/4 'Material No.' ,22 'Material Type' ,
             37 'Material Group'.
      WRITE:/ sy-uline.
      LOOP AT itab1.
        WRITE:/4 itab1-matnr ,20 sy-vline ,22 itab1-mtart ,
               35 sy-vline ,37 itab1-matkl,sy-uline.
        HIDE itab1-matnr.
      ENDLOOP.
    AT LINE-SELECTION.
      CASE sy-lsind.
        WHEN '1'.
          SELECT amatnr bmaktx INTO CORRESPONDING FIELDS OF TABLE itab2
          FROM ( mara AS a INNER JOIN makt AS b ON amatnr = bmatnr )
          WHERE a~matnr = itab1-matnr.
          WRITE:/ sy-uline.
          WRITE:/4 'Material No.' ,22 'Material Text'.
          WRITE:/ sy-uline.
          LOOP AT itab2.
            WRITE:/4 itab2-matnr ,20 sy-vline ,22 itab2-maktx,
                     sy-uline.
          ENDLOOP.
    here when my at line-selction is working,in select query,hide is not updated,its contains the last record value f itab1,where it should have value i selected from display.
    thus my seconday list is showing the value of last record of itab1 all time.
    please tell,how to make it working?
    vipin
    Edited by: Vipin on Jun 18, 2008 5:23 PM

    Hi,
    Check the example code , this will help you.
    REPORT demo_list_hide NO STANDARD PAGE HEADING.
    TABLES: spfli, sbook.
    DATA: num TYPE i,
    dat TYPE d.
    START-OF-SELECTION.
    num = 0.
    SET PF-STATUS 'FLIGHT'.
    GET spfli.
    num = num + 1.
    WRITE: / spfli-carrid, spfli-connid,
              spfli-cityfrom, spfli-cityto.HIDE: spfli-carrid, spfli-connid, num.
    END-OF-SELECTION.
    CLEAR num.
    TOP-OF-PAGE. WRITE 'List of Flights'.ULINE. WRITE 'CA CONN FROM TO'. ULINE.
    TOP-OF-PAGE DURING LINE-SELECTION.
    CASE sy-pfkey.
    WHEN 'BOOKING'.
    WRITE sy-lisel.
    ULINE.
    WHEN 'WIND'.
    WRITE: / 'Booking', sbook-bookid,'Date ', sbook-fldate.ULINE. ENDCASE.
    AT USER-COMMAND.
    CASE sy-ucomm.
    WHEN 'SELE'.
    IF num NE 0. SET PF-STATUS 'BOOKING'. CLEAR dat. SELECT * FROM sbook WHERE carrid = spfli-carridAND
    IF sbook-fldate NE dat.connid = spfli-connid. dat = sbook-fldate. SKIP. WRITE / sbook-fldate.POSITION 16.
    ELSE. NEW-LINE. POSITION 16.
    ENDIF.
    WRITE sbook-bookid.
    HIDE: sbook-bookid, sbook-fldate, sbook-custtype,
    sbook-smoker, sbook-luggweight, sbook-class.ENDSELECT. IF sy-subrc NE 0.
    WRITE / 'No bookings for this flight'.
    ENDIF.
    num = 0.
    CLEAR sbook-bookid.
    ENDIF.
    WHEN 'INFO'.
    IF NOT sbook-bookid IS INITIAL.
    SET PF-STATUS 'WIND'.
    SET TITLEBAR 'BKI'.
    WINDOW STARTING AT 30 5 ENDING AT 60 10.
    WRITE: 'Customer type :', sbook-custtype,
    / 'Smoker :', sbook-smoker,
    / 'Luggage weight :', sbook-luggweight UNIT 'KG',
    / 'Class :', sbook-class.
    ENDIF.
    ENDCASE.
    Regards,
    Raj.

  • Interactive report errors when trying to query external table.

    I'm trying to create an interactive report against an external table and getting the following error. I see a note in metalink the describes its cause, but I doesn't seem to apply here.
    Query cannot be parsed, please check the syntax of your query. (ORA-06550: line 2, column 17: PLS-00302: component 'ODCIOBJECTLIST' must be declared ORA-06550: line 2, column 13: PL/SQL: Item ignored ORA-06550: line 4, column 18: PLS-00302: component 'ORACLE_LOADER' must be declared ORA-06550: line 4, column 6: PL/SQL: Statement ignored ORA-06550: line 5, column 12: PLS-00320: the declaration of the type of this expression is incomplete or malformed ORA-06550: line 5, column 6: PL/SQL: Statement ignored)
    Metalink Note:437896.1 identifies this same error related to external tables. It says the cause is an object named 'sys' that exist in the user's schema and must be removed. I checked dba_objects and there is no object named 'sys'

    Please ignore thread - operator error. There was an object named sys.

  • Interactive Reports - Database Hack for sharing developer saved reports

    Just this morning I posted to another thread about not being able to create and save multiple reports, but after a bit of database hacking, I've got it working in version 3.1.2.
    I take no responsibility in anything that may happen to your APEX install because of what I am about to tell you.  If you try this, you do so at your own risk.
    That's right, you CAN create multiple default views for your users.
    Background:
    <ul><li>     I created 1 interactive report.</li>
    <li>     I added criteria and saved the report with the name Report1.</li>
    <li>I modified the criteria and saved the report with a new name 3 additional times.</li>
    <li>I am now seeing 5 tabs
    <ul><li>Working Report</li>
    <li>Report1</li>
    <li>Report2</li>
    <li>Report3</li>
    <li>Report4</li>
    </ul>
    </li>
    <li>At this point, other users can not see the reports because they are private to me.</li>
    </ul>
    So, how can I make these reports public to other users?
    <ul><li>Logon to your APEX database as a user that has privileges to select and update the WWV_FLOW_WORKSHEET_RPTS table.</li>
    <li>Browse the table and find the 4 rows of the new reports that were created above.</li>
    <li>Set the SESSION_ID and BASE_REPORT_ID columns to NULL</li>
    <li>Set the APPLICTION_USER column to 'APXWS_DEFAULT'</li>
    <li>Set the STATUS column to 'PUBLIC'</li>
    <li>Set the IS_DEFAULT column to 'Y'</li>
    </ul>
    It seems to be the combination of APPLICATION_USER and IS_DEFAULT that really makes it work, but I set the other fields to make them look like the row for the working report.
    So, now after making these changes, I had two other users login to the site and look at the interactive report, and viola, 5 default tabbed reports!
    Hope this helps someone!!!
    Kris

    Hello,
    Just to stress, that the moment you do direct modifications to WWV_FLOW_WORKSHEET_RPTS (or indeed any 'internal' table) via this non-supported route you are probably making your APEX installation non-supported by Oracle (hopefully someone from Oracle can speaking officially on that).
    Even if your update works today, tomorrow, in a months time, you have still done something that you were not supposed to do.
    So, do you really want to do that in production?
    Just playing Devils Advocate.
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

  • Changing usernames - migrating saved Interactive Reports

    Hi all,
    We are changing our authentication scheme for our Apex 4.2 app. Unfortunately the new authentication provider requires us to use usernames of a different format to those that we currently use. This will make our saved interactive reports for each of our many users "disappear" as they are saved against a given username. For example, where I may have had the username SURNAME1234 I will now have FIRSTNAME.SURNAME1
    I haven't found any Oracle-sanctioned method of doing this migration rather than just altering data in the Apex Schemas. If there is one, I would be very grateful to hear of it, but I haven't spotted anything in my searches.
    If I do have to just hack around in the data, I've devised the following update statement to "migrate" the usernames:
    UPDATE apex_040200.wwv_flow_worksheet_rpts
    SET application_user = :DG_USER_ID
    WHERE application_user = :OLD_USER_ID;
    ... Can anyone think of any complications that might arise from this? Is there anything more I need to do to ensure that the system remains internally consistent? It seems to work ok in my initial testing (moving a report from one user to another).
    Any help greatly appreciated,
    Alex.

    Alex / Duncs,
    There isn't any supported way to change the owner of saved reports in the current release of APEX 4.2.3.  The UPDATE statement given by Alex is unsupported and dangerous as it can touch rows which are not saved reports.  We will provide a supported PL/SQL API to change the saved report owner in the future release of APEX.
    Regards,
    Christina

Maybe you are looking for

  • HT201412 My iPad 1 crashes every time I open a game app, and for some sites and blogs such as Facebook or Awesomer. What's wrong with it?

    Hi, my iPad 1 can barely open a game for more than a couple of minutes without crashing and going back to the home screen. I've had it for about 2 years but it has been happening for about a year, and now it's annoying me more than ever. It happens o

  • Netflix - No Video on 55X850C

    Trying to play Netflix video on native TV app. Everything is great until I launch the video. Blue screen with "no signal" shows up. Audio is playing. Pushing "pause" pops the navigtion bar up, but background is still blue, with no video. THis is not

  • Bug in CFCACHE

    Hi, I upgraded our Coldfusion server from version 7.02 to 8. Until version 7.02 CFCACHE worked fine. After migration I´m having problems with accents. The problem is the Apache (2.0) has iso8859-1 set as DefaultCharset. Looking into Coldfusion Admini

  • Download in AppStore fails because Graphics Adapter

    When I want to download the update of FCPX and Motion I got the message that my graphics adapter don't support the minimum requirements. I bought both programs on the same MacPro dual core 3 Ghz. 12 GB RAM ATI

  • Period Repostings' Cycle shows No Sender & Receiver

    Gurus, A slight problem; TCode KSW5 is periodic repostings; wherein a cycle has to be included to run the repostings. However; the cycle is made correctly but the WARNING message that appears says that neither receiver / sender has valid values. Kind