Executing query based on parameter.

Hi, iam new to Oracle Reports and need some help on handling multiple queries.
I have 2 queries A,B where A is a subset of B ( B has some extra columns to be included in the select and where clause).
Now i need to execute A and B according to a parameter value which i select using a list box.
For example there are two values open and close in the list box.
If i select open, query A should execute and if i select close, B should execute and report be diaplayed accodingly...Please let me know how this should be done.
Thanx

In the data model you can not have a variable number of columns based on the parameter selection. You need to bring the maximum number of columns in the data model, and then show or hide certain columns in the layout model using format triggers based on the parameters.

Similar Messages

  • Execute query based on LOV

    Hi,
    Is there a special code to execute query based on selecting one of the options by the user in the LOV???? or it is as simple as the following???
    Set_Block_Property('PAYMENT_VOUCHER',Default_Where,'payment_method=:PAYMENT_VOUCHER.payment_method'); >>>> in the search button trigger(WBP):::
    Execute_Query;
    Note that the payment method field has a LOV...

    Tasneem wrote:
    ok..
    I tried to set this thread as answered but cannot!!!! believe me...None of answer you get as Helpful or Correct. ???
    You should read...Before posting on this forum please read

  • Run query based on parameter

    Hi,
    I have a report where i'm selecting values based on parameter entered by user. There are only 2 options e.g A or B.
    If A then select *
    where name = A
    or if B then select *
    where name != A basically select everything apart from A.
    Can anyone please tell me how to do this. Thanks.

    There are many ways to do this .
    easy way that i use.
    in the "where clause" of sql query statement
    SELECT decode(SUBSTR(TO_CHAR(FIELD_NAME),1,3),'EFT','IND','USA')
    FROM TABLE
    WHERE decode(SUBSTR(TO_CHAR(FIELD_NAME),1,3),'EFT','IND','USA')=
    NVL(:P_SOURCE,decode(SUBSTR(TO_CHAR(FIELD_NAME),1,3),'EFT','IND','USA')
    Then you have to add these'IND and 'USA' in parameter form( drop down list)
    note: use only required functions.

  • Differet Load query based on parameter input

    Hi all,
    I'm developing my first application with HTML DB and I have a problem. I have a table with no primary key and a unique index on three columns and only one of these can be null. I'm building a form with my events that execute a query based on the data passed from another page.
    My problem is that I have two queries (one with the clause column_a is null and another one with column_a=value) but I'm not able to condition the execution on more than one item values; I'd like to know how to express into conditional processing section
    PXXvariable_1 is null and PXXvariable_2 is not null.
    I can use a workaround in the query using nvl but I'm wondering if is possible to expresso such constraints in constional processing section.
    Thanks to all,
    Giovanni

    Giovanni,
    See this section of the documentation on the HTML DB URL syntax:
    http://download-west.oracle.com/docs/cd/B14117_01/appdev.101/b10992/mvl_fund.htm#sthref447
    You want something like this:
    f?P=101:<page ID>:&APP_SESSION.::::PXXPARAM_1,PXXPARAM2:VAL,
    Here, PXXPARAM_1 will be set to VAL and will be set to NULL
    Sergio

  • How do I change the query based on parameter value

    hi,
    Based on parameter value I want to change my query. If paramter value is 'O' i want the 'order by depno' in query if the value is null i don't want the order by clause.
    How do I achieve this.
    Thanks
    Ram

    U can use lexical parameter
    i.e u create one user parameter and in query
    u use this parameter with &param_name
    ex.
    select val,prize from stock where sr_no > :srno
    orderby &ord_by
    here ord_by is lexical parameter
    and set its intial value to 'sr_no'
    so u can get result order by sr_no
    this parameter is set from form so u will give condition in form and depending
    on condition u will pass this parameter from form.

  • SSRS report with tabular model - MDX query to filter parameter data based on Tuple value.

    Hello Everyone,
    I am working on SSRS report in which a tabular model is being used as a backend.
    I want to filter the report parameters which are dependent to other parameters. Like, country, state, and cities drop downs.
    All are multi-select parameters. I am using MDX queries to filter the parameters data.
    Based on selected one or more countries, the data of states needs to be filtered.
    The point is the text which is being displayed in state dropdown for each state name is combination of 3 different members.
    So, I created the following Tuple for the same and can see the expected display names in states dropdown.
    "("+
    [Location].[Code 1].CURRENTMEMBER.UNIQUENAME +","+
    [Location].[Code 2].CURRENTMEMBER.UNIQUENAME +","+
    [Location].[Descr].CURRENTMEMBER.UNIQUENAME +")"
    Now, when I would like filter the cities data based on selected one or more states, I am unable to pass the multiple Tuples (more than one selected Tuples) as parameter for cities dropdown.
    The following is my query for City parameter. It is working well when I select only one State from the dropdown.
    However, when I select multiple states, it is unable to convert the Tuple into SET in ELSE part of IIF condition specified in following query.
    Can anybody help me how to resolve the error that I am getting about STRTOSET function?
    Or
    Are there any other alternatives to achieve this requirement?
    Any help would be much appreciated.
    Query:
    WITH MEMBER [Measures].[ParameterCaption] AS [City].[City Business].CURRENTMEMBER.MEMBER_CAPTION
    MEMBER [Measures].[ParameterValue] AS [City].[City Business].CURRENTMEMBER.UNIQUENAME
    MEMBER [Measures].[ParameterLevel] AS [City].[City Business].CURRENTMEMBER.LEVEL.ORDINAL
    SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS ,
    [City].[City Business].Children ON ROWS
    FROM (
    SELECT ( STRTOSET(@State, CONSTRAINED) ) ON COLUMNS FROM [Model])
    WHERE ( IIF( STRTOSET(@State).Count= 1,
    STRTOTUPLE(@State, CONSTRAINED),
    STRTOSET("{
    ("+
    [Location].[Code 1].CURRENTMEMBER.UNIQUENAME +","+
    [Location].[Code 2].CURRENTMEMBER.UNIQUENAME +","+
    [Location].[Descr].CURRENTMEMBER.UNIQUENAME
    + ")
    }",CONSTRAINED )) ) CELL PROPERTIES VALUE
    Thanks, Ankit Shah
    Inkey Solutions, India.
    Microsoft Certified Business Management Solutions Professionals
    http://www.inkeysolutions.com/MicrosoftDynamicsCRM.html

    Hi,
    I used following dynamic query in expression of dataset of parameter and it works like a charm.
    "WITH MEMBER [Measures].[ParameterCaption] AS [City].[City Business].CURRENTMEMBER.MEMBER_CAPTION "&
    "MEMBER [Measures].[ParameterValue] AS [City].[City Business].CURRENTMEMBER.UNIQUENAME "&
    "MEMBER [Measures].[ParameterLevel] AS [City].[City Business].CURRENTMEMBER.LEVEL.ORDINAL "&
    "SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS , " &
    "[City].[City Business].Children ON ROWS " &
    " FROM [Model] WHERE ({"& join(Parameters!Location.Value,",") &"}) CELL PROPERTIES VALUE"
    Thanks, Ankit Shah
    Inkey Solutions, India.
    Microsoft Certified Business Management Solutions Professionals
    http://www.inkeysolutions.com/MicrosoftDynamicsCRM.html

  • Include Button that executes PL/SQL procedure to SQL query based region

    I would like to add two columns to a SQL query region.
    These columns would not be sourced from the query, but rather would be used to execute a PL/SQL procedure.
    For example, I would like to have a manager approve or deny adding an additional employee to the department.
    There would be one button for APPROVE. And, one button for DENY.
    The PL/SQL procedure would execute to perform the required DML based upon the selected action (either APPROVE or DENY).
    A sample output would look like this:
    <APPROVE>, <DENY>, John Doe, Accountant
    <APPROVE>, <DENY>, Jane Doe, Accountant
    Is there any way to add a button to a SQL Query based report region where that button executes a stored proc? If so, what is the basic process for doing this?
    Thanks!
    -Reid

    Is there any way to add a button to a SQL Query based report region where that button executes a stored proc? If so, what is the basic process for doing this?Conditional page item? You can associate processes with buttons on a page

  • Profile Parameter : Time out for executing query on the web

    Hi gurus,
    I am executing queries on the web directly. This can be done from query designer with the button that says "Execute query on web". The problem is that for queries that take more than 600 Secs to run, I get an Application timed out error. Queries that take less than this run smoothly.
    Can anyone please tell me the profile parameter associated with this particular setting. It is not rdisp/max_wprun_time, I know for sure since the value for this profile parameter in my system is 9999. Please help.
    Thanks & rgds,
    Sree

    Issue resolved.
    Profile Paramter - icm/server_port_0
    Current Value - PROT=HTTP,PORT=8000,TIMEOUT=60,PROCTIMEOUT=600
    Changed to - PROT=HTTP,PORT=8000,TIMEOUT=60,PROCTIMEOUT=3600
    rgds,
    Sree

  • CANT execute query with parameter on user defined tables using query genera

    Dear All,
    I have problem when executing query with parameter on user defined tables using query generator.
    It seems SBO cannot accept parameter to query user defined tables.
    I've tried these:
    SELECT T0.U_Status FROM [@ST_PR_H] T0 WHERE T0.U_Status = [%0] --- this FAIL
    I try to pass the value directly without using parameter and It works
    SELECT T0.U_Status FROM [@ST_PR_H] T0 WHERE T0.U_Status = 2 --- this SUCCESS
    This one works
    SELECT * FROM RDOC T0 WHERE T0.width =[%0]  --- this SUCCESS
    and this one works too
    SELECT * FROM RDOC T0 WHERE T0.width = 595  --- this SUCCESS
    Is there anyone can help me ....???
    Thanks,
    Alfa

    I  generated this code using query wizard ....
    SELECT T0.[U_Status] AS 'Document Status' FROM  [dbo].[@ST_PR_H] T0  WHERE T0.[U_Status] = (N'2' )
    and replaced the (N'2' ) with [%0]
    SELECT T0.[U_Status] AS 'Document Status' FROM  [dbo].[@ST_PR_H] T0  WHERE T0.[U_Status] = [%0]
    and It worked ......
    Thanks 4 all .....

  • Passing Parameter before execute-query?

    I want to do the following scenario, please I need help so I can do this.
    On Execute query i want a parameter to be passed.
    For Example
    I have a table of employees, and if any user executes query on employees form then before execution of query, form must first asks to give it a department name then it executes the query and of course we will get the result of that specific department.
    I hope i have made clear what i am looking to do. but i need help here.
    Thanks in advance.
    Maz

    Several ways
    May be the easiest:
    . define a non-DB Item (of apropriate type) ahead of your block to be queried,
    may be in a new non-DB-block (depends on lyout of forms
    . check on pre-query if there's a value given and abort if empty
    . define in the where clause of the block: emp.columns = :<block.crit_item>
    where crit item is the above mentioned non-DB-Item.
    More effort for the following alternative:
    . define a window
    . define a content canvas (for the new window)
    . define a non-DB-block with a non-DB-Item
    . set focus to that item on KEY-EYEQRY (assumes that key-Exeqry is called in your query process) and ask user to enter the value
    . redo query (KEY-EXEQRY on that block or add a button), this includes to set focus back to your daa block and do exe-qry there
    . set where claus in analogy to above.

  • Executing query with arguments- issue when  parameter value contains '&'

    My application inserts 'First name', last name' and last upd date to the table. it inserts all the data properly. Next level I access the information along with other tables using same arguments. But it is not fetching any data. I noticed it happens whenever the '&' is included in the parameter (first name). eg:
    'Margaret & John'. From the logs I noticed that first name it is not taking what I passed. It just stripping the first name from '&' onwards and taking only 'Margaret'. Here is the example from the log. You could notice only 'Margaret' instead of 'Margaret & John' in place of first argument.
    <2007-03-29 11:35:51,425> <DEBUG> <default.collaxa.cube.ws> <Database Adapter::Outbound> <oracle.tip.adapter.db.DBInteraction executeOutboundRead> Executing query with arguments [Margaret , Cohen, 2007-03-29T11:35:51-06:00]
    Appreciate your help if you could give me a hint how to resolve this issue
    Thanks
    Reddy

    Hi Reddy,
    from the log it looks like the DbAdapter received the value as 'Margaret '. Because parameter binding is used by default, the database shouldn't try to interpret the & as it is inside a bind variable.
    Could it be that the & is getting dropped somewhere else? Marc was suggesting you put that value inside a CDATA section or escape it. He probably showed that but when he hit Post Message it displayed the escaped & as &. I think we should find out where that & got dropped though. Normally BPEL will preserve it.
    Thanks
    Steve

  • SOURCING10: Passing parameters to a Query Based webservice using JAVA

    Hi Experts,
    I have been working on consuming a Query based webservice published in Souricng10 in a simple JAVA class. The query has a filter parameter which is not mandatory. I am able to consume the webservice using the GET method and display the content of the webservice. But when i try to POST a value to the filter parameter of the query i am getting the following error:
    java.io.IOException : Server returned HTTP response code: 415 for URL: http://sapcild9.web.bc:55000/sourcing/ngservices/rest/query/Z_TEST_WS_QUERY/execute/
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    Following is the code which i have used:
       URL url = new URL("http://sapcild9.web.bc:55000/sourcing/ngservices/rest/query/Z_TEST_WS_QUERY/execute/");
       HttpURLConnection connection = (HttpURLConnection)url.openConnection();
       connection.setRequestProperty("Authorization", "Basic " + authStringEnc);
       connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
       connection.setRequestProperty("Content-Length", "" +Integer.toString(urlParameters.getBytes().length));
       connection.setRequestProperty("Content-Language", "en-US");
       connection.setUseCaches (false);
       connection.setDoInput(true);
       connection.setDoOutput(true);
       connection.setAllowUserInteraction(true);
       connection.setInstanceFollowRedirects(false);
       connection.setRequestMethod("POST");
       connection.connect();
       //Send request
       OutputStream out = connection.getOutputStream();
       OutputStreamWriter wr= new OutputStreamWriter(out, "UTF-8");
       wr.write("EXTERNAL_ID");
       wr.write("=");
       wr.write(URLEncoder.encode("temp","UTF-8"));
       wr.close();
       out.close();
       is = connection.getInputStream();
       isr =new InputStreamReader(is);
       BufferedReader bufferReader = new BufferedReader(isr);
       String str; StringBuffer stringBuffer = new StringBuffer();
       while ((str = bufferReader.readLine()) != null) {
       stringBuffer.append(str);
       stringBuffer.append("\n");
       System.out.println(stringBuffer.toString());
       connection.disconnect();
       is.close();
    Please Advise how to proceed on this isssue?
    Thanks in advance.
    Srikanth Emani

    Hi Gael,
    your URL is made up of :
    [ProcedureName]?[parameter1]=[value1]&[parameter2]=[value2]
    creating URLs like this can have problems especially with spaces and punctuation.
    the answer is a FORM
    the following will create a hidden form :
    FORM ACTION="[ProcedureName]" METHOD="POST" name="F1"
    INPUT type="HIDDEN" name="[parameter1]" value="[value1]"
    INPUT type="HIDDEN" name="[parameter2]" value="[value2]"
    /FORM
    you can set the values in the form using:
    document.F1.[parameter1].value="abc123%%&&$$!";
    document.F1.submit();
    will submit the form and the PL/SQL procedure should receive the text as it was contained in the form.
    the only characters that can now cause problems are :
    " as it delimits the field.
    ' as it may cause problems in PL/SQL.
    \ as it is a special character.
    Regards Michael

  • XSQL query output as parameter for next xsql query

    Hi,
    Is it possible to use the output of one xsql query as input parameter for the next xsql query in the same file. I am trying to retreive an id from the query and use it in the next one. I cannot combine all the queries into one, since I intend to make the first query a database function that returns the id I am looking for. I am looking for something like this
    <xsql:query>
    select '1000' as myid
    from dual
    </xsql:query>
    <xsql:query>
    select add1,ro1
    from table1
    where id = {@myid}
    </xsql>
    I need the id returned by the first query to be used in the second one. Eventually my first query will be a stored procedure that validates the users rights and on sucess return the following tag <myid> 1000 <myid>.
    Please let me know , how I can achieve my goal of validating a user's priveleges and then executing the second query.
    Thanks
    Padmaja

    Hi ,
    Thanks for the response.This works if the first query is a select .
    If the first query was a call to a db procedure that returned the <myid>100<myid> would this still work?
    <xsql:set-page-param name="myid">
    <xsql:include-owa>
    xyz;
    </xsql:include-owa>
    </xsql:set-page-param>
    <xsql:include-param name="myid"/>
    <xsql:query>
    select name from mytable where id={@myid}
    </xsql:query>
    I have to use include-owa as the db procedure xyz does some cookie validations and then returns an id based on that. The procedure xyz returns an xml tag of form <myid>100<myid>
    This does not work as the value of myid is not available to the second query.
    Thanks
    Padmaja

  • BEx query based on virtual cube donu00B4t display a valid List of Value (LOV)

    Hello
    I have a problem with an invalid LOV. The scenario is the following; There´s a BEx query based on a virtual cube. The query has an exit variable on caracteristic that is based on 0CALMONTH.
    At Universe Designer I simply create a connection, a universe based on this query and export.
    At Web Intelligence (also at Live Office), when I try to execute de query, the prompt to fill my exit variable display a list of value that doesn´t match with the values of the caracteristic at the cube.
    Actually, the list at the prompt starts with 01.0000 and finishes with 05.0968.
    In Universe Designer, the option to edit the list of values is not available. But I think that editing the LOV is not the correct way.
    I´ve tried creating a new query based on the DSO that is the source of the virtual cube. In this case, I had a valid list. Unfortunately, I can´t use this DSO.
    Did anyone already have this problem?

    Hi James,
    can you explain what you mean with "input length for that filed" ?
    The field in the table is varchar2(120). I coudn't found options for the List of value.
    Thanks for your response
    Carsten
    null

  • SSRS 2008 - hide chart lines based on parameter selected

    How to control visibility of chart lines based on Params selected by user?
    By default, my report display last 3 years worth of data (including current) with Month on the x axis and Counts on the y axis. I have two Boolean parameters:
    TwoYrs? T/F
    ThreeYrs? T/F
    if False is selected for TwoYr and ThreeYr parameters then I want to hide chart lines corresponding to last year and the year before.
    What I've tried: Created 3 Series groups with filters. eg. YearSeries1 to return only current year data and applying an expression to display it if params TwoYrs and ThreeYrs = False. and so on for YearSeries2 to return current + last
    years data if param TwoYrs is True and ThreeYrs = False.  But I don't see where to add expression to control the display of the individual series groups.  I am open to any way of doing this, but this seemed most logical.

    Hi Ok-Hee,
    In your Source Query just need to filter the series data based on the Parameters.
    I have written sample query below:-
    select * from
    select 1 monthnumber , 'Jan' MonthName, 2013 year,100 amount
    union
    select 1 monthnumber , 'Jan' MonthName, 2014 year ,200 amount
    union
    select 1 monthnumber , 'Jan' MonthName, 2015 year , 300 amount
    union
    select 2 monthnumber , 'Feb' MonthName, 2013 year, 300 amount
    union
    select 2 monthnumber , 'Feb' MonthName, 2014 year, 350 amount
    union
    select 2 monthnumber , 'Feb' MonthName, 2015 year,200 amount
    union
    select 3 monthnumber , 'Mar' MonthName, 2013 year, 380 amount
    union
    select 3 monthnumber , 'Mar' MonthName, 2014 year, 100 amount
    union
    select 3 monthnumber , 'Mar' MonthName, 2015 year, 500 amount
    )t
    where year in (
    select distinct FilterYear from
    select case when @TwoYrs=1 then year(getdate())-1 else year(getdate()) end FilterYear
    union
    select case when @TwoYrs=1 and @ThreeYrs =1 then year(getdate())-2 else year(getdate()) end FilterYear
    union
    select year(getdate()) FilterYear
    ) t
    I have created one post in my blog , you can check the result.
    https://msbitips.wordpress.com/2015/03/12/ssrs-2008-hide-chart-lines-based-on-parameter-selected/
    Thanks
    Prasad

Maybe you are looking for