Report based on dynamic query

I have done the same way as shown in the 'How To document'. But it does not work. It just ignores what is mentioned inside the if-end if construct. I have used the sample application itself and followed exactly what is mentioned in the article.The output is the same for 'ALL' as well as any other category selected.
I have observed that in the report region, the report type namely 'PL/SQL function body returning SQL Query', the if construct just does not work as expected. The code is accepted without throwing any errors but, the result is only one half works, mostly the if portion, what follows the else is ignored.
I am not sure whether i am committing a mistake somewhere or there is a bug in the application builder itself.
Can anybody throw light on this.
I am using application express 2.1 version

Thanks for your response.
The How-to document that referred is available here in the following url:
http://www.oracle.com/technology/products/database/application_express/howtos/dynamic_report.html
the PL/SQL code is given below. P22_show is the item name(select list).
declare
q varchar2(4000);
begin
q:=' select p.category, ';
q:=q||' p.product_name, ';
q:=q||' i.quantity, ';
q:=q||' i.unit_price ';
q:=q||' from demo_product_info p, ';
q:=q||' demo_order_items i ';
q:=q||' where p.product_id = i.product_id ';
if :p22_show != 'ALL' then
q:=q||'and p.category = :p22_show';
end if;
return q;
end;

Similar Messages

  • Interactive report based on dynamic query

    Hello
    I am using Apex 4.1 and have a requirement to create an interactive report based on a dynamic query. This option is available in Classic report but in Interactive this feature is not there. Tried using collections or just a view (thought of changing the view definition during "On load", but structure of the report is already defined based on the definition of the view at design time).
    Is there any way of achieving this?
    Appreciate any help!
    Thanks
    aks

    Try looking at this: http://rakeshjsr.blogspot.com/2010/10/oracle-apex-interactive-report-based-on.html
    Thank you,
    Tony Miller
    Dallas, TX

  • How to - Build a report based on dynamic query

    I am using this how to and find out that there is an syntax error on this example, where the and should be where. I got an SQL parsing error when I followed this example until I debugged with the debug while on this page. Has any one using this how to and have the same problem?
    if :p600_show != 'ALL' then
    q:=q||'and p.category = :p600_show';
    end if;
    declare
    q varchar2(4000);
    begin
    q:=' select p.category, ';
    q:=q||' p.product_name, ';
    q:=q||' i.quantity, ';
    q:=q||' i.unit_price ';
    q:=q||' from demo_product_info p, ';
    q:=q||' demo_order_items i ';
    q:=q||' where p.product_id = i.product_id ';
    if :p600_show != 'ALL' then
    q:=q||'and p.category = :p600_show';
    end if;
    return q;
    end;

    [regarding bind variables]
    Well, from what I saw in
    http://www.oracle.com/technology/products/database/htmldb/howtos/dynamic_report-1.6.htm
    the dynamic SQL is constructed by doing concatenation of user input and SQL keywords
    'select col1,col2 from table where co1='||:P1_COL1
    So, this is going to flood the shared pool with unique SQL statements with different values of :P1_COL1 and also subject to SQL injection, isnt it? You obviously disagree and I am happy to be proven wrong, please do so?
    To avoid having to deal with SQL parsing errors, you
    could put a condition on the region so that it
    doesn't render (parse) whenever any elements of
    session state are not sufficiently populated to allow
    the formation of a valid SQL query that would be
    parseable without errors.Thats exactly what I want to do, but didnt know what condition that would be? I didnt see any condition saying "Session state not initialized" or something like that.
    Thanks

  • Bold a single row in a Report based on SQL Query

    Should be easy? So, how do I bold a single row in a report based on SQL query without creating a new template or writing Java for the page? What is the Tabular Form Element "Element Attributes" field for? Or what am I supposed to put in there to make it do anything?

    One way to do this is to add a hidden column to your report which contains the formatting value, for example:
    select empno
    , ename
    , sal
    , decode(empno,1,'font-weight:bold','font-weight:normal') style
    from emp
    Hide the STYLE column.
    Then you can use this column for each column in Column Formatting > HTML expression in this way:
    <span style="#STYLE#">#SAL#</span>
    Unfortunately you have to do this for each colum you want to appear bold.
    good luck,
    Dirk Dral

  • How to bulid a Crystal report based on Bex query as source

    Hi,
    I have requirment where the end user wants the query in Crystal.I built a Bex query in Bex query designer.I would like to know how to create crystal report based onthe Bex query.
    Thanks,

    Hi
    The Crystal Reports are integrated with BW such that the query built in BW can be used to bulit Crystal Reports on them.
    After launching the Crystal Reports, you will have and option : "Open reprt from BW" whcih will help you in opening the BW Queries and create Crystal Reports.
    Also in the Menu there is an optin SAP-->Create New Report from a Query
    Regards, Hyma
    Edited by: Hymavathi Yanamadala on Aug 13, 2009 5:52 AM

  • Generating report based on dynamically generated sql query

    I have to rewrite asp reports to oracle reports.
    The original application has forms in asp where reports are generated dynamically based on the options selected.
    There are many options to select.
    Some add filter criteria to where clause.
    I have no problem with this. As i can generate report using parameter form.
    whereas i don't know how to generate reports whose columns change based on the user selection.
    The front end screens are going to be in java and jsp pages. The only way i can think of is generating reports on all possible options the user may select. But, as there are more than 15 options, i think this is not the right approach.
    How can i achieve this.
    Thank you very much.
    navya.

    One method that comes to mind would be to use an after parameter form, and use lexical parameters to create dynamic statements.
    For example in your after pform:
    If :P_NAME = 'JOHN' then
    :P_SELECT = 'SELECT COL1, COL2 ';
    :P_FROM = 'FROM JOHN ';
    :P_WHERE = 'WHERE COL3 = 'JOHN';
    END IF;
    Then in your query, you could say:
    &P_SELECT
    &P_FROM
    &P_WHERE
    Something like that - If only parts of you where statement will change, you can just write that one part -
    like
    IF :P_STATE is not null then
    :P_STATE = ' and table.state = :P_STATE_IN ';
    else :P_STATE = ' and 1=1 ';
    end if;
    and in your query...
    where....
    &:P_STATE
    So IF a person enters a state, then limit the search to that state, or else do a 1=1.
    Hope this gives you a start

  • WebI report based on BEx query in Live Office document

    Hi
    We have a BEx query in BW that has one input ready variable (period). Then we have created a WebI report based on this BEx query (the WebI report itself does not have any prompts). When we run the WebI report we get asked to enter a value in the BEx variable (remember: this is not a WebI prompt). Until this stage everything works fine. Then we have created a Live Office document and added the WebI report. When we refresh the Live Office document, the BEX variable is not shown. The data that is retrieved is from the last time the WebI report run. The refresh option is set to u201COn demand: From the databaseu201D.
    Is there a way to get the BEx variables to be shown when refreshing the Live Office document? Remember, we do not use WebI prompts.
    We use BW 7.3 and BO BI 4.0.
    Kind regards
    Erik

    Hi,
    Unfortunately, this feature has not been developped the BICS connectiviy. It is only available for manda
    tory prompts based on universe. Others have noted the same problem, so there is an enhancement request for the feature to be available using BICS connection in the "Ideas Place".
    Use the link to vote for the idea, more votes gives a better chance that this will be picked up for development.
    [LifeOffice idea|https://cw.sdn.sap.com/cw/ideas/4094]
    Thanks,
    Marianne

  • Crystal Report based on BW query

    We create a Crystal report (CR 2008 ) with the main report based on on Bex Query on an SAP BW Server based on an infocube and a sub report based on an SQL relational table (Table, cluster or SAP Functions) on the same SAP BW Server. The execution is Ok on the Crystal Client but when we deploy on the InfoView portal (and on CMC) we have only one connection defined (it seems it detect that it was the same server name and keep only the first connection).

    We don't use Universe (For Bex Query SAP don't recommande it) . The queries are directly embeded in the crystal report

  • BO BI 4.0: WebI report based on BEx query (OLE DB enabled)

    Hi Experts
    We are trying to create WEBI reports based on BEx queries, but we are experiencing some issues. We have created two BEx queries og two separate multiproviders and opened them for external use but checking the OLE DB enable checkbox. In WebI we are now only able to use on of the queries as a data source (even though both are OLE DB enabled).
    Are there any limitations to which multiproviders that can be used to create BEx queries for WebI reports?  
    We are using BO BI 4.0 and BW 7.0 SP 5.
    Kind regards
    Erik

    Hi again Henry
    We use BW 7.01 Support package 5 (we know it should have been at least 6), SAP GUI 7.20 patch 9, BEx 7.2 patch 6 and BO 4.0 patch 11.
    The BW user that is synchronized to BO has almost all rights (almost sap_all). When we log on to BEx directly with the same user we use in BO, we are able to run both BEx queries without any problems. When we then log on to BO (with the same user), we are only able to use on of the queries in WebI.
    As you say, we have to following setup:
    -     BO users are synchronized from our BW system and when they log on to BO they use the SAP authentication.
    -     The user that is synchronized from BW has been added to the Administrator group in BO  
    -     The OLAP connection is set to SSO so that the authorization in the BW system is used.
    It is really strange that we are not able to use on of our multi providers in BW in WebI. As you say, we just need to try debugging with changing the authorization concept, changing the OLAP connection setup and so on to see if that helpsu2026
    Kind regards
    Erik

  • Need a Little Help embedding a Hyper Link in Report  based on Dynamic SQL

    I am trying to have a column in my report link to a document on my network when the column in the report is clicked. I have a table that contains a row for each document I want to link to. The URL to the document is stored in a column named NDDL.DOC_LINK. I would like the text "Linked" to appear as the value in the report column and to be a hyper link to the document.
    The report is a "Classic Report" based on PLSQL retuning a SQL stament. I am on Apex version 4.2.1.00.08
    I have been fighting with the '''''' stuff and can not get it worked out. have pasted the line in question but I can not get it to display correctly so I am hoping someone can help out.
      q := q || '  NDDL.DOC_TITLE as FILE_NAME, ';
      q := q || '  NDDL.DOC_DESC, ';
      q := q || '  ''<a href="http:'' || NDDL.DOC_LINK || ''target="_blank"> </a>'' as LINKED , ';
      q := q || '  NDDL.MOD_DATE, '; 
    ...The # in the line above should be:
    {code}
    http:'' || NDDL.DOC_LINK || ''target="
    Thanks!
    Edited by: Sky13 on Mar 7, 2013 12:45 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    I anwered your email. The PL/SQL block is like this:
    /* Formatted on 2013/03/07 23:05 (Formatter Plus v4.8.8) */
    DECLARE
       q   VARCHAR2 (4000);
    BEGIN
       q := 'select * from ( ';
       q := q || 'select ';
       q := q || '  NDDC.NDDC_UID, ';
       q := q || '  NDDC.NDND_UID, ';
       q := q || '  NDDC.LSVL_DOC_CAT_UID, ';
       q := q || '  NDDC.DATE_POSTED, ';
       q := q || '  NDDC.CREATE_DATE, ';
       q := q || '  NDDC.CREATE_BY, ';
       q := q || '  NDDC.MOD_DATE, ';
       q := q || '  NDDC.MOD_BY, ';
       q := q || '  NDDC.MIME_TYPE, ';
       q := q || '  NDDC.FILE_NAME, ';
       q := q || '  NDDC.CHARACTER_SET, ';
       q := q || '  NDDC.BLOB_MOD_DATE, ';
       q := q || '  NULL as DOC_DESC, ';
       q := q || '  NULL as DOC_LINK, ';
       IF :p24_doc_contains IS NOT NULL
       THEN
          q := q || '  score(1) as SCORE ';
       ELSE
          q := q || ' NULL as SCORE ';
       END IF;
       q := q || 'from ';
       q := q || '  NDDC_NODE_DOC NDDC ';
       q := q || 'where ( ';
       q :=
             q
          || ' INSTR(UPPER(CREATE_BY),UPPER(NVL(:P24_SEARCH,CREATE_BY))) > 0  or ';
       q := q || ' INSTR(UPPER(MOD_BY),UPPER(NVL(:P24_SEARCH,MOD_BY))) > 0  or ';
       q :=
             q
          || ' INSTR(UPPER(MIME_TYPE),UPPER(NVL(:P24_SEARCH,MIME_TYPE))) > 0  or ';
       q := q || ' INSTR(UPPER(FILE_NAME),UPPER(NVL(:P24_SEARCH,FILE_NAME))) > 0 ';
       q := q || ') ';
       IF :p24_doc_contains IS NOT NULL
       THEN
          q := q || '  and CONTAINS(document, :P24_DOC_CONTAINS,1) > 0 ';
       END IF;
       q := q || 'union all ';
       q := q || 'select ';
       q := q || '  NULL as NDDC_UID, ';
       q := q || '  NDDL.NDND_UID, ';
       q := q || '  NDDL.LSVL_DOC_CAT_UID, ';
       q := q || '  NDDL.DATE_POSTED, ';
       q := q || '  NDDL.CREATE_DATE, ';
       q := q || '  NDDL.CREATE_BY, ';
       q := q || '  NDDL.MOD_DATE, ';
       q := q || '  NDDL.MOD_BY, ';
       q := q || '  NULL as MIME_TYPE, ';
       q := q || '  NDDL.DOC_TITLE as FILE_NAME, ';
       q := q || '  NULL as CHARACTER_SET, ';
       q := q || '  NDDL.MOD_DATE as BLOB_MD_DATE, ';
       q := q || '  NDDL.DOC_DESC, ';
       q :=
             q
          || '  ''<a href="http:'''
          || '||nddl.doc_link||'''
          || '-.htm" target="_blank"> </a>'' as DOC_LINK , ';
       q := q || '  NULL as SCORE ';
       q := q || 'from ';
       q := q || '  NDDL_NODE_DOC_LINK NDDL ';
       q := q || 'where ';
       q :=
          q
          || '  ( INSTR(UPPER(CREATE_BY),UPPER(NVL(:P24_SEARCH,CREATE_BY))) > 0 ';
       q := q || '  or INSTR(UPPER(MOD_BY),UPPER(NVL(:P24_SEARCH,MOD_BY))) > 0 ';
       q :=
             q
          || '  or INSTR(UPPER(DOC_TITLE),UPPER(NVL(:P24_SEARCH,DOC_TITLE))) > 0 ';
       q :=
             q
          || '  or INSTR(UPPER(DOC_DESC),UPPER(NVL(:P24_SEARCH,DOC_DESC))) > 0 ) ';
       q := q || '  ) ';
       --htp.p(q);
       DBMS_OUTPUT.put_line (q);
    END;Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • ADF table based on dynamic query

    I am new in JDeveloper and ADF.
    I want to add an updatable ADF table on a JSF page, but I want to use
    dynamic criteria for the query on which the table will be based on.
    The user will fill in some fields then press a button. Then a daynamic
    where clase will be created and the table
    will be populated.
    How can I do this?

    Hi,
    You should get aquainted with ViewCriteria for your ViewObject.

  • Report based on custom Query - Question about Data Source

    Hello,
    I am trying to create Crystal reports (EBO R3.1, Oracle 11g Database, CR2008) based on custom queries. Tried using different kinds of Data Sources but getting stuck once I export them to Infoview.
    1. Using Oracle Server: This method works fine on my local & Infoview. But since I have lot of reports, I do not want the DB username/password associated to the report. I neither want BO to prompt username/pwd to my user.
    2. Using ODBC(RDO):
    Again, works fine on my local. Once I export to Infoview, it fails with this error: "Failed to open the connection"
    Which makes sense, because the DSN is created on my local machine and not on the server.
    How and what do I create on the server, so that the reports run?
    I do not know if using ODBC(RDO) is even the right way for creating custom SQL reports.
    I have been reading about Business Views, but not clear on how good they work.
    My goal is to create multiple reports, using custom SQL queries which use some kind of connection to the database that can be managed on the
    server in one place, and used by multiple reports.
    Can any of you please help me here
    Thanks,
    Sowmya.
    Edited by: SBat22 on Apr 13, 2011 5:58 PM

    Thanks for moving it to the right forum!!
    But, if I setup in CMC, a default username/password that the report needs....what would happen if my password changes?
    I would need to go to each and every report and update the password.
    I am looking for using one common "connection" for multiple reports. So that, when passwords change, all I update is in one central location.
    Can anyone please help!
    Thanks,
    Sowmya.

  • How to do a report based on dynamic apex checkbox item value

    Hi All,
    First of all I would like to thank for taking your time to read this.
    I have created a report region with a dynamic checkbox. Now I would like the user to tick few of these checkboxes and click on another link which will take the values of these checkboxes and run an sql statement. I know how to include a standard page_item's value ('where :=P#_ITEM') but I am totally lost on how to do this with dynamic checkboxes. I have been going through many threads here but all of them talk about deleting and updating the displayed records.
    Could you please help?
    Thanks, Naushad.

    Hi David,
    I have not created any checkboxes in the page, below the sql for generating the checkboxes. Now I would like to run another sql to on some other tables where the values of these checkboxes will be used in the 'where' clause:
    ***SELECT DISTINCT Q1.LOAD_NBR, T.DESTINATION, apex_item.checkbox(1,q1.load_nbr, 'UNCHECKED')"SELECT_LOAD"***
    ***FROM TERMINALS T,***
    ***(SELECT DISTINCT C.LOAD_NBR, SUBSTR(C.PKT_CTRL_NBR,1,3) AS "SHOP"***
    ***FROM CARTON_HDR@WMSR C, PKT_HDR_INTRNL@WMSR P***
    ***WHERE C.PKT_CTRL_NBR = P.PKT_CTRL_NBR AND C.MOD_DATE_TIME > (SYSDATE)-1 AND P.STAT_CODE >39 AND P.PKT_CTRL_NBR NOT LIKE '0%' AND C.STAT_CODE <> 99)Q1***
    ***WHERE Q1.SHOP = T.SHOP_NO***

  • Report Layout width(Report based on SQL Query)

    Is there any way to increase the width of the report layout? I have removed as many columns as I can and dropped the font size down but the data in the columns is still wrapping to more than one line. How can I increase the report layout width, or change the layout to landscape or something similar.
    thanks

    I had this problem with wrapping text. You have to create a Reports From SQL Query and choose a custom layout. Then when you go the the HTML layout section, you will need to ad nowrap to the <TD> tag (i.e. <TD nowrap>) for each field you do not want to wrap.
    Martin

  • ProcessdpCommandEx error when adding or removing object from WebI report (based on BEX query) query panel object list

    Hi,
    We have WebI reports build on BEX using BAPI connectivity. When we are trying to add a object in query panel in a existing report we are getting this ProcessdpCommandEx error. But error does not appear when we add at the end of the list of objects already added.
    Can you calrify whether this could be some setting issue or it is a known bug?
    Can you share SAP Note No in case it is a known bug?

    Hi Avijit,
    This error occurs in case of any failure in the connectivity. It is like the data providers are not getting processed.
    You have mentioned that the issue does not come with newly created reports
    Are you creating new reports on migrated universe or a newly created universe?
    If issue only comes with migrated universe, please check if the connection has been migrated properly and required middleware and database connectors are in place.
    If connections are in place, try importing and exporting the universe once and check.
    In case, new report works fine with migrated universe, then you can simply try to re-point the universe by editing the query and can run it again and check.
    Regards,
    Yuvraj

Maybe you are looking for

  • Does PSE 8 run on MacOS 10.9 Mavericks?

    MY CURRENT HARDWARE: Apple iMac (late-2012 slimline model), 2.9 GHz Core i5, 8 GB RAM, 1 TB Hard drive, external DVD drive MY CURRENT SOFTWARE: MacOS 10.8 Mountain Lion iPhoto 2011 Adobe Photoshop Elements 8 (with Bridge CS4) We have an aging white M

  • Crop Marks not in correct place when Bleed applied - possible Bug/Error?

    Apologies if anyone has posted this elsewhere - I checked the Help, FAQ, Forums and Googled it - but I really can't find a solution to this minor problem I'm having. I have created a document that will be cut to 120mm x 120mm, I wanted to include a 1

  • Best PPCS5 output codec for import to FCE

    Got a friend who's had trouble capturing from my XHA1 into Final Cut Express on his Macbook Pro. So I'm capturing using PProCS5 and I'm going to export the clips for him to edit on his FCE. I don't have any special codec packages installed, just the

  • Sharing music downloaded from CDs in itunes

    I have the orginal ipad but the pc i used to set it up an sync is no longer working. I downloded music from my personal cd collection to the ipad using itunes cd reader.  I have all this music on the ipad and just purchased a new ipad mini.  How can

  • Seting up a lab

    Hi I set up a loopback0 as 192.168.22.2 /16 and when setting up a s0 w/ 192.168.22.3 /16 . I get labr1(config-if)#ip address 192.168.22.3 255.255.0.0 192.168.0.0 overlaps with Loopback0 now I did chng loopback0 to 1.1.1.1 and I and I am ok , but just