Dynamic generated SQLfor report regions

is it possible to do the following to generate the sql statement of a report region dynamically?
for example i have on page 1 some checkboxes ( to show or not to show columns of the report)
checkbox1: show col1
checkbox2: show col2
checkbox2: show col2
based on the selection of these checkboxes i would like to dynamically generate the sql content of a report region on page2
Select col1, col3,
from my_table

Andy, thank you very much! this looks perfect to me.
just one more question:
Is it ( or will it be) possible to change the sql source of a report region itself dynamically
my "dream" would be an object related approach like :
reportregion_name.sql_source = v_sql;
where v_sql is generated dynamically by a procedure or process.
i had a look at ps/sql dynamic regions, but i have the feeling that i would loose all advantages of APEX ( like page rendering,...)

Similar Messages

  • Weird behavior: PLSQL-generated SQL Report Region

    I am trying to tune my PLSQL-generated SQL Report Region. I put in some code to write the resulting query to a table. I turn it on, run the page, and then turn it off and look at the SQL. Instead of getting one query for each time I load the page, I get five. Trying to find out a bit more about why, I concatenate :APP_USER and to_char(sysdate, 'hh:mi:ss') to the resulting SQL. What I find is that four of the entries in the table have my ApEx dev username, and all of these writes are 3 seconds before the SQL generated under the app username is written!
    It probably goes without saying, but in all of the writes under my dev username, there are no session values and so any PLSQL if statements that depend on a session value act as if the session values are null. Also, any place I have :APP_ID show up as 4000 in those writes instead of the app number that shows up under my app username.
    Do you follow this?
    Well, on a hunch I copied the whole region back on to the page and disabled the original. This time, no writes with the dev username, only one select statement as originally expected.
    Is that wierd or what?
    Bill

    Scott, Your last comment - that was it. I should've paid more attention to the time. The minutes must have been off. I made sure to log out of the dev environment before I ran the page, but the writes under my dev login were occurring when I saved the region. I still don't see why that process causes four identical writes, but it's not that important.
    Thanks! Now I can to working on the real problem - improving my SQL.
    Bill

  • Cannot generate a reports region with a search field in an existing app.

    I have not found a way of generating a reports region with a search field on an existing page in an existing application.
    Can anyone help?
    n.b. I am using htmldb with Oracle XE

    If it's DPS no. There is no native search available.
    You'd have to do the entire thing in HTML.
    Bob

  • Dynamically refresh to report regions

    I have a page with multiple regions. Two of the regions are report regions that I want to refresh dynamically. I am using 4.0. I created a dynamic action that fires based on an item's value changing. It contains two actions, a 'Refresh' action for each region. Only one region will refresh. If I put an 'Alert' action between the two 'Refresh' actions, then both regions will be refreshed. I have tried to do this multiple ways, such as using the $a_report() function from within my page level javascript. Results are the same. I can get one region to refresh, but not two. Any ideas or suggestions on why I can not refresh multiple regions?

    Thanks for your reply. I tried what you said and still no luck. I then created a new page with two simple regions, a select list, and a button to trigger the refresh. I wanted it be stripped of any other items or code and I used your javascript. It still only refreshes one region. I am requesting space on the Oracle site and will create my test there. Maybe there is a bug in the version we have installed. Our version is 4.0.0.00.46.

  • Dynamic query in reports region(multiple condition)

    Hi I have this sql query in the report region. And everytime I will run the report and choose to put a value on :P3_REQUESTID and the rest of the variables to null.It doesnt display the report.The same goes to other variables except for :P3_OOTSELECT.
    If I choose to put a value on :P3_OOTSELECT and the rest to null, thats the only time that report will be displayed.
    What am I missing here?
    SELECT req_id,
    order_no,
    cust_nm,
    cust_req_type,
    entered_by,
    alt_ref,
    decode(cnt_rfs,null,null,'Yes')RFS,
    rec_id
    FROM oot_curr_stats
    WHERE (trunc(create_dt,'MONTH') like :P3_OOTSELECT OR
    trunc(create_dt) between to_date(:P3_FROMDT,'dd/mm/yyyy') AND to_date(:P3_DATETO,'dd/mm/yyyy'))
    AND req_id like '%'||:P3_REQUESTID||'%'
    AND sla_tag like :P3_SLATAG
    Thanks,
    acinorev

    Veronica (?),
    It doesnt display the report.
    What do you mean by that? The report query doesn't execute? Or it does execute and shows "no data found" or something?
    If you "choose to put a value on :P3_REQUESTID and the rest of the variables to null" then this part of the predicate won't match any rows (I'll replace the null bind variables with null):
    (trunc(create_dt,'MONTH') like null OR
    trunc(create_dt) between to_date(null,'dd/mm/yyyy') AND to_date(null,'dd/mm/yyyy'))
    Then you AND that with other terms but by then it's too late.
    Perhaps I misunderstood.
    Scott

  • 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

  • How to create a inline message for report region...

    Hi,
    Can any one pls tell me the document link for to create a inline error message for report region?
    im trying to do a dynamic validation for report region.i've manually created a report region with apex item.
    im searching it for long time, im cant able to find any demos or example.
    Pls help.....
    Thanks in advance...

    Any help???

  • Erratic Report Region Behavior with Dynamic SQL Queries

    I'm running HTMLDB v 1.5.1.00.12 and I've noticed some odd behavior with report regions using dynamic SQL queries. Every so often, our testers will run a page containing a dynamic sql report region and get the following error, (despite the fact the query was working only moments ago and no other developer has touched it):
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    or sometimes
    failed to parse SQL query:ORA-01403: no data found
    The only solution I've found so far is to:
    1) Make a copy of the failed report region.
    2) Disable or delete the original failed report region.
    The new copy of the report region runs without issue.
    My search of the forums turned up the following two threads, but neither provided me with a clear explanation of the cause, and how to avoid it:
    ORA-06502:PL/SQL: numeric or value error: character string buffer too small
    Re: Import Export Error (ORA-06502)
    The columns being returned are below the 4000 character limit, and the rows being returned are far less than 32k in size.
    Could this have anything to do with the way HTMLDB is internally storing the PL/SQL used to generate the dynamic SQL Query? Is there any known issue related to this with that version of HTMLDB?
    This problem occurs without any discernable pattern or consistency, making it hard to determine where I should focus my efforts in tracking down the cause.

    Hi all,
    My report seems to be behaving correctly once i set it to "Use Generic Column Names (parse query at runtime only)" :)
    Cheers,
    Joel

  • ORA-01489 Received Generating SQL for Report Region

    I am new to Apex and I am running into an issue with an report region I am puzzled by. Just a foreword, I'm sure this hack solution will get a good share of facepalms and chuckles from those with far more experience. I welcome suggestions and criticism that are helpful and edifying!
    I am on Apex 4.0.2.00.07 running on 10g, I believe R2.
    A little background, my customer has asked an Excel spreadsheet be converted into a database application. As part of the transition they would like an export from the database that is in the same format as the current spreadsheet. Because the column count in this export is dynmic based on the number of records in a specific table, I decided to create a temporary table for the export. The column names in this temp table are based on a "name" column from the same data table so I end up with columns named 'REC_NAME A', 'REC_NAME B', etc. (e.g. Alpha Record, Papa Record, Echo Record, X-Ray Record). The column count is currently ~350 for the spreadsheet version.
    Because the column count is so large and the column names are dynamic I've run into a host of challenges and errors creating this export. I am a contractor in a corporate environmentm, so making changes to the apex environment or installation is beyond my influence and really beyond what could be justified by this single requirement for this project. I have tried procedures and apex plug-ins for generating the file however the UTL_FILE package is not available to me. I am currently generating the SQL for the query in a function and returning it to the report region in a single column (the user will be doing a text-to-column conversion later). The data is successfully being generated, however, the sql for the headers is where I am stumped.
    At first I thought it was because I returned both queries as one and they were joined with a 'union all'. However, after looking closer, the SQL being returned for the headers is about +10K+ characters long. The SQL being returned for the data is about +14k+. As mentioned above, the data is being generated and exported, however when I generate the SQL for the headers I am receiving a report error with "ORA-01489: result of string concatenation is too long" in the file. I am puzzled why a shorter string is generating this message. I took the function from both pages and ran them in a SQL command prompt and both return their string values without errors.
    I'm hopeful that it's something obvious and noobish that I'm overlooking.
    here is the code:
    data SQL function:
    declare
      l_tbl varchar2(20);
      l_ret varchar2(32767);
      l_c number := 0;
      l_dlim varchar2(3) := '''|''';
    begin
      l_tbl := 'EXPORT_STEP';
      l_ret := 'select ';
      for rec in (select column_name from user_tab_columns where table_name = l_tbl order by column_id)
      loop
        if l_c = 1 then
            l_ret := l_ret || '||' || l_dlim || '|| to_char("'||rec.column_name||'")';
        else
            l_c := 1;
            l_ret := l_ret || ' to_char("' || rec.column_name || '")';
        end if;
      end loop;
        l_ret := l_ret || ' from ' || l_tbl;
      dbms_output.put_line(l_ret);
    end;header sql function:
    declare
      l_tbl varchar2(20);
      l_ret varchar2(32767);
      l_c number := 0;
      l_dlim varchar2(3) := '''|''';
    begin
      l_tbl := 'EXPORT_STEP';
      for rec in (select column_name from user_tab_columns where table_name = l_tbl order by column_id)
      loop
        if l_c = 1 then
            l_ret := l_ret || '||' || l_dlim || '||'''||rec.column_name||'''';
        else
            l_c := 1;
            l_ret := l_ret || '''' || rec.column_name || '''';
        end if;
      end loop;
        l_ret := l_ret || ' from dual';
      dbms_output.put_line(l_ret);
    end;-------
    EDIT: just a comment on the complexity of this export, each record in the back-end table adds 12 columns to my export table. Those 12 columns are coming from 5 different tables and are the product of a set of functions calculating or looking up their values. This is export is really a pivot table based on the records in another table.
    Edited by: nimda xinu on Mar 8, 2013 1:28 PM

    Thank you, Denes, for looking into my issue. I appreciate your time!
    It is unfortunately a business requirement. My customer has required that the data we are migrating to this app from a spreadsheet be exported in the same format, albeit temporarily. I still must meet the requirement. I'm working around the 350 columns by dumping everything into a single column, which is working for the data, however, the headers export is throwing the 01489 error. I did run into the error you posted in your reply. I attempted to work around it with the clob type but eneded up running into my string concatentation error again.
    I'm open to any suggestions at this point given that I have the data. I'm so close because the data is exporting, but because the columns are dynamic, the export does me little good without the headers to go along with it.

  • Dynamic action with interactive report region refresh

    Hi!
    I'm using APEX 4.02
    I've got a page with 2 regions.
    Region1 is a (input) form
    Region2 is an interactive report on the same table as region 1
    When entering values on the form I'm trying to dynmically lookup similar records in the table with the interactive report.
    I've made a dynamic action on the change of the form fields which should refresh the interactive report region. I can see this one fires if I add a alert to debug if it fires.
    The dynamic report is based on a query with bind variables pointing to the form fields, for example
    where
    field1 = :P2_FIELD1
    This works great on the page load, so no dynamic action is fired but I can see the rows in the report region are the ones I am looking for.
    But the refresh of the report region is not working, it is never refreshing and/or showing the correct data after a change of the form fields, so it looks like the dynamic action "refresh region" is not working on the interactive report.
    Any ideas why this can go wrong ?
    I would like to solve this using standard dynamic actions and preferrably not via PL/SQL or JS, shoudl be possible if I should believe the documentation... ;)
    Cheers
    Bas
    Edited by: bklerk on 26-apr-2011 3:07

    Hi,
    When you change value to item, I assume you do not set value to session state.
    Use interactive report advanced attributes "Page Items to Submit" , set items session state before report is refreshed.
    http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/app_comp.htm#sthref1235
    Similar post/issue here
    Hide and show region - hides on refresh
    Regards,
    Jari

  • Apex 4.2 dynamic action to refresh a report region on a different page

    Hi,
    I open up a pop up window from a report region. When the user is done in the pop-up window and closes it, can I trigger a refresh on the report region using dynamic actions without actually reloading the whole page? I know I can use dynamic action on a page to refresh the report region on the same page.
    Thanks,
    Sinan

    Sinan,
    So long as the region to be refreshed is still loaded, you can do this. I don't know how you are loading your pop-up or unloading it but, the principle should be the same as what I provide below.
    Assume that you have set the static ID for your report to MY_REPORT. (Be sure you have checked "Allow Partial Page Refresh" in the Report Attributes).
    $('#confirmBox').find('div#userConfirmationMessage').html( '<span class="userInputRequest">Would you to Refresh your Report?</span>' );
    $('#confirmBox').dialog(
        autoOpen: true,
        modal: true,
        title: 'Refresh Conformation',
        buttons:
            'No': function ()
                $(this).dialog('close');
            'Yes': function ()
                $(this).dialog('close');
                 $('#MY_REPORT').trigger('apexrefresh');
    -Joe

  • Generate a Report Dynamically without User Intervention and Output to XML

    Here's the scenario for which I am trying to find a solution. Any help would be greatly appreciated.
    I have a series of reports that the users generate from a UI by selecting the report, setting the values for a list of parameters, and then click a submit button. The report is generated in the UI for them to view. They can print it from here or export it to Excel.
    They would like to be able to schedule a report to run daily without user intervention using a saved set of parameters. The system would run the report automatically and email it to a defined set of email addresses.
    To do this, we need to have the report generated in a string or xml so a Java process can read it and email it.
    I see that I can change a report's template to export:xml so I feel that it is possible. How can I export a report to XML without user intervention? Can the report template be changd dynamically at runtime? Ideally, I need some way to call this same report and have it output as a string data or xml to be used by a Java process that would store and generate the report for email.

    Hi Kumar,
    From Program1 you are calling Program2, using submit syntax (inside Program1).
    While using submit, if you have correctly filled up the selection screen of program2, then it will AUTOMATICALLY get executed, WITHOUT F8.
    If there is any compulsary field in program 2, which does not get populated, then it will not run automatically, or unless some special code is written in program2.
    If you do not want the output of Program2 on screen, then u can use
    SUBMIT Program2 AND RETURN.
    In that case, no selection screen (of program2) will appear and neither the output of program 2.
    Regards,
    Amit Mittal.
    Edited by: Amit Mittal on Dec 23, 2009 4:10 PM

  • Dynamic action in a report region in a master detail form

    hi
    I have created a master detail form , in which many validation etc is done ,the MASTER is a FORM  and DETAIL is a REPORT
    Now I am stuck up with the detail region .i.e report
    I have Line Detail where there are ITEMS such as SL NO: ,ITEM_ID , UOM ( Unit of measuremnt ) etc
    Now here is where I need help .
    Using POP UP LOV i have managed to fetch in LOV for the item "ITEM_ID",--- i can select an item name using the pop up LOV ,
    Now all that I want is when I select an item name from the pop up lov , an Item Id is displayed or fetched in that particular place , now i want the corresponding UOM to be diaplayed  ( i.e the UOM for that particular Item Id which has been selected by me from the pop up lov ).
    In order to resolve this I created a Dynamic action where in I get the UOM . Bt the problem is that the ITEMS displayed for selecting in the WHEN section (
    DYNAMIC action
    -IDENTIFICATION section
    -WHEN section----- items (  here i am not listed with ITEMS of the REPORT region instead ITEMS of the MASTER is available )
    -TRUE ACTION section etc is only the
    ITEMS of the MASTER region ..
    Please help me sort this out

    Mod: moved from Japanese Apex

  • Dynamically generating the ssrs dataset and filling the data into the dataset and binding it to ssrs report dynamically

    I have a work to do, in ssrs we are using server reports in our project. i am looking for dynamically generating the ssrs dataset and filling the data into the dataset and binding the dataset to ssrs report(RDL) dynamically.
    Getting the dataset dynamically has a solution by using Report Definition Customization Extension (RDCE), but the problem is binding that dataset to the report(RDL) dynamically was not there.
    Here is the reference for RDCE http://www.codeproject.com/Articles/355461/Dynamically-Pointing-to-Shared-Data-Sources-on-SQL#6
    I looked for binding the dataset to the report(RDL) dynamically and searched many sites but i did not get the solution. Can anyone help me here.
    Is there any custom assemblies or any Custom data processing extensions to work around. Please help.
    Thanks in advance

    Hi Prabha2233,
    Thank you for your question.
    I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated.
    Thank you for your understanding and support.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • How to Set Report Region Title Dynamically

    I have code working to periodically refresh a Interactive Report on a page. I have the following code in the page header:
    <script type="text/javascript">
    //automatic reload IRR
    function fnc_reloadIRR () {
    gReport.search('SEARCH');
    window.setTimeout(fnc_reloadIRR, 10000);
    // this means the code execution starts after 10 seconds
    window.setTimeout(fnc_reloadIRR, 10000);
    </script>
    This is working great. The title of the report region is "Intraday Color Code Test - &P1_LAST_REFRESH_TIME."
    I have a hidden page item named P1_LAST_REFRESH_TIME on the page that contains the last time the report was refreshed. I am struggling with resetting this value when the report region is refreshed. ( May not even need this item!)
    To address this, I created an On Demand application process that gets the Last Refreshed string. I then altered the above code like this:
    <script type="text/javascript">
    //automatic reload IRR
    function fnc_reloadIRR () {
    var ajaxRequest = new htmldb_Get( null, &APP_ID., 'APPLICATION_PROCESS=SET_LAST_REFRESH_TIME',0);
    gReport.search('SEARCH');
    window.setTimeout(fnc_reloadIRR, 10000);
    ajaxResult = ajaxRequest.get();
    // this means the code execution starts after 10 seconds
    window.setTimeout(fnc_reloadIRR, 10000);
    </script>
    Note the addition of the ajaxRequest stuff. This, too, is working. That is, if I check the value in ajaxResult, it does contain the correct, current time. So far so good.
    What I can't figure out is how, now, to get a reference to the title attribute of the Interactive Report Region so that I can reset it.
    I AM SOOOOO CLOSE. Can anyone fill in this last part of the puzzle for me?

    To clarify, I really just need to know how to get a reference to the Report Region's title so that I can set it to the value currently stored in "ajaxResult"

Maybe you are looking for

  • Multiple choices in a SELECT list or a DECODE block?

    I know I have a lot of questions lately, but I am fairly new to Oracle. I have this query - it looks awful, but I just want to refer to the DECODE line. This line works, but I have more than one word that is valid. There are actually 3 or 4. Is there

  • Purchse Order Text using SECATT

    Dear all I am using SECATT for material master uploading. I want to upload Purchase Order Text using SECATT Please suggest me how can  I upload same using SECATT. Vipin

  • Age calculation in report builder query

    I am using SQL reporting services 2008 and report builder I have setup a report where I want to calculate the age of each student.  I have table called Students with a DOB field.  I want to display the age of each student and also use the age field i

  • Illustrator cs6 zoom problem cinteq 24hd touch

    i have problems with the zoom function illustrator cs6. i am using a cinteq 24hd touch and macbook pro latest software. i can zoon out with the wheel and touch but the zoom to does't work. can somebody help me?

  • Ref Classroom in a book. Avance by one frame by clicking steo forward button

    Hi In the book classroom in a book, it is said (lesson 5) that by the monitor, by clicking the step forward (backward) button you advance by one frame. But in fact When I click I advance by one seconde so 30 frames and not one. What do I do wrong? Ao