Snapshot with Parameterized Query?

How could i call snapshot in IOP using a parameterized query.
for e.g. My MDX query is as below:
+select  {+   
+Parameter("Measure",Member,[Measures])+
+}on columns,+
non empty (CrossJoin(
+{Fiscal.[P7.2012]},+
+{Region.[NY]},+
+{Division.[56]},+
+{Commodity.[333-3333]}+
+))+
on rows
+from [Margin]+
When i try to use this query for snapshot it's giving an error.
Is there any way to make my snapshot command parameterized so that i could get data of the only measure which is required?

Its not straightforward.
You have to generate the xml file dynamically import it using import isadmin command and then run the snapshot query on top of it.

Similar Messages

  • Sort GridControl modeled with parameterized query (bug?)

    I am using JDev 3.2.3. I created a ViewObject in expert mode which contained a parameterized query:
    select emp_name, salary
    from employees
    where
    dept_no = :1
    Then, through a few workarounds, I managed to create a BC4J data form containing a GridControl linked to the ViewObject.
    Cleared the associated empsRowSetInfo.queryOnOpen(false).
    Created a button with action event:
    empsRowSetInfo.setQueryConditionParams(new Object[] {
    deptId
    empsRowSetInfo.executeQuery();
    This all works fine.
    ***The problem***
    If you press on a header to re-sort the grid, a bad sql query error is thrown and details shows the following bad query:
    select * from (
    select emp_name, salary
    from employees
    where
    dept_no = :1)
    order by asc emp_name
    ORA-00904: invalid column name
    The GridControl headers appear to be getting their own copy of the ViewObject's query, then misinterpretting it. This works fine for non-parameterized queries since the column names are explicit. However :1 is not a column name but a place holder in my parameterized query.
    Shouldn't the headers be using the same mechanism to sort the grid as used to populate the grid model originally?
    Any suggestions for a workaround? Pressing a column header fatally breaks the form. Pressing the button again to re-execute the original query continues to throw the error!
    Thanks,

    This is clearly a bug.
    DAC is in 9.0.2 + replaced by JClient.
    It might be hard to get a fix for this problem.
    As far as a workaround.
    You can provide your own SortDelegate.
    Start with diagnosing the problem by extracting the SortDelegate class out of 'dacf-src.zip'.
    Change it into a mySortDelegate.java.
    Set the sortDelegate property on the gridControl. (use an instance of mySortDelegate).
    You should be able to step into your implementation and see what the problem is.
    Hopefully you will be able to fix the problem in your sortDelegate class.

  • Need help with parameterizing query

    Hello,
    Database Version: 11gR1
    I have created a materialized view in my database which stores the moving average of Amount and Cummulative Amount for different customers for different months. The moving average window period is 6 months..i.e., If my base table has data for a customer for a period of 1 year(JAN07-DEC07), then in the materialized view the average values will be stored for each customer as follows:
    JAN-07 --Avg(JAN-07)
    FEB-07 --Avg(JAN-07, FEB-07)
    MAR-07--Avg(JAN-07,FEB-07,MAR-07)
    APR-07--Avg(JAN-07,FEB-07,MAR-07,APR-07)
    MAY-07--Avg(JAN-07,FEB-07,MAR-07,APR-07,MAY-07)
    JUN-07--Avg(JAN-07,FEB-07,MAR-07,APR-07,MAY-07,JUN-07)
    JUL-07--Avg(FEB-07,MAR-07,APR-07,MAY-07,JUN-07,JUL-07)
    AUG-07--Avg(MAR-07,APR-07,MAY-07,JUN-07,JUL-07,AUG-07)
    SEP-07--Avg(APR-07,MAY-07,JUN-07,JUL-07,AUG-07,SEP-07)
    OCT-07--Avg(MAY-07,JUN-07,JUL-07,AUG-07,SEP-07,OCT-07)
    NOV-07--Avg(JUN-07,JUL-07,AUG-07,SEP-07,OCT-07,NOV-07)
    DEC-07--Avg(JUL-07,AUG-07,SEP-07,OCT-07,NOV-07,DEC-07)
    Actually i need the values only from the month of July...i.e., avg values for the month of July, Aug, Sep, Oct..and so..But i dont want to hard code the date value in my Materialized view Query..Because as of now the data in my base table is till Dec-07..but it may increase also..So if i hard code the value to what i require now, then in future i may again have to change the query..
    So my question is, Is there any way by which i can parameterize the date values in my materialized view query, so that my materialized view stores the data for date only which i require..
    One more problem is as and when my base table grows, my materialized table would also grow if i dont parameterize the date in the query. So i need to avoid that also..
    One solution what i thought of is to keep data in my base tables only for the required period.i.e., when i want the average values for the month of July, then the data in my base table will be only from Feb-07 to Jul-07, and for the month of Aug data will be only from Mar-07 to Aug-07 and so...So that when i refresh my MV, there will be only six months data, and the number of rows in my MV will be constant and hence the MV size also will be constant..
    Is there any way by which i can schedule to delete the data from my base table as when month changes..I want it to be done automatically when month gets changed..So if anybody knows of a way to do it, Please help me...
    It will be of great help..

    Hi,
    You're creating a materialized view with one row for every combination of customer_id and month, but you don't really want all those rows. What you really want are just the rows where month=target_month, and you (wisely) don't want to hard-code "month=target_month" into the WHERE-clause of the view definition. Is that right?
    If so, you can create a one-row table called param, which has a column for storing the target_month. Your view can do a scalar sub-query or a cross-join to get the value from the param table to use in its WHERE-clause.

  • ADF how can i execute a query with parameters when the page renders

    hi
    i am using ADF web 11g
    i need to execute a query with parameters when the page renders
    thanks

    hello,
    I'm a fan of Java code, I really am.
    But when you use ADF, you decided to move to a more declarative environment.
    So why not do it declarative, the adf way?
    In your pagedef insert a action binding.
    This can be anything, a call to the application module, a call on the iterator(Like executeWithparams, etc.)
    Create an invokeAction in your pagedef and set the condition.
    This example refreshes(Action 2 is execute query) the data.
    First the method binding:
        <action IterBinding="PersoonIterator" id="Execute" InstanceName="LSAppModuleDataControl.Persoon"
                DataControl="LSAppModuleDataControl" RequiresUpdateModel="true" Action="2"/>And the invoke action
        <invokeAction Binds="Execute" id="refreshData"/>This always refreshes the data on page entry, but anything is possible, you can set condictions for the invokeAction.
    -Anton
    PS Yes I know that pagedefs become backing beans in the end and yes that is Java code, but if you wanna play the ADF way, the goal is the reduction of Java code and the increased performance of declarative programming.

  • Query with parameters syntax

    Hi,
    Could somebody please help with the C# syntax for Oracle Lite. I can execute select statement without parameters, but parameterized query doesn’t work. What is wrong in my code?
    LiteConnection liteConn=new LiteConnection("10270_pwcoffline");
    LiteCommand lcmd=new LiteCommand() ;
    lcmd.Connection=liteConn;
    lcmd.CommandText="Select * from ol_off_dept where office = :off";
    lcmd.CommandType=CommandType.Text ;
    int off = 10;
    LiteParameter p1 = new LiteParameter("off", DbType.VarNumeric, "office");
    p1.Value = off;
    lcmd.Parameters.Add(p1);
    LiteDataAdapter lad=new LiteDataAdapter(lcmd);
    DataSet ds=new DataSet();
    lad.Fill(ds,"TDM");
    this.dataGrid1.DataSource = ds;
    The error is:
    System.Data.DataException: 37000[POL-5228] syntax error at Oracle.Lite.Data.LiteCommand.Prepare()…
    Thanks

    Jenny,
    Please let us know if you still need this post resolved.
    Thank you.

  • Unable to connect: incorrect log on parameters. (CR with InfoSet Query)

    Hi ,
    I have created a crystal report with InfoSet Query in Crystal Report Designer 2011. And it works fine, data extraction also works fine. After that, I have uploaded it into BI Platform 4.0. I can display the CR via clicking View from context menu. But it was still failed once I tried to schedule it in BI launch Pad.
    The error message is : Error in File ~tmp314c6a47c20e892.rpt: Unable to connect: incorrect log on parameters.
    It's so stranger, since i can view it in Designer and viewing it direct in BI lauch Pad. Do you have met this same issue within BI Platform 4.0. Thanks.
    Best Regards,
    Simon Shen

    Not sure if this will help but I finally had success with running a report with a database connection. Here is what I learned from other posts:
    1) Make sure you are using the ODBCAD32.exe located in \windows\syswow64 folder. It's the 32 bit Administrator, the one in the Control Panel is the 64 bit versions and it won't work with a 32 bit app.
    2) Make sure you use System DSN, not User DSN.
    Other tips...
    1) Create a blank report (no parameters, no db connection). Run and get that to work first.
    2) Create a basic db report (no parameters, one table, one field). Run and get that to work second.
    3) If step two fails, try creating a report with different drivers.
    4) If step three fails, try installing the latest service packs and repeat 1-3.
    5) If step four fails, throw out the software or computer or both

  • How to query Database with Parameters  and configure null value response?

    Hi,
    1.When capture attributes from forms & after applying several logics, passing to a DB table using an API, how to get relevant values for a given parameter in another DB table ?
    2.When a DB table is queried, if the value does not exist, how to configure the response message ?
    Thanks.

    Okay, you've provided exactly what John S. asked for - and no more. This is helpful, but not enough. I think we're going to need a use case to understand exactly what you are asking. What should the user see? What does the user do next? What should happen in the database and in the application when the user does this?
    However, I'll try to read between the lines a bit, and get you part of the way there. To query the database with parameters in ADF BC, you need a View Object (VO). The simplest thing to do is create the SELECT command behind the VO with some bind variables and add the bind variables to your VO. At that point, you will get an ExecuteWithParameters operation in the Data Control. You can drag that operation onto a JSF page and it will give you an option to create a parameter form to let the user fill in the parameters to set the bind variables, and a button to execute the query with these values. Any table or form based on that same VO will show the selected data.
    A Trinidad or ADF Rich Faces table will have an attribute to let you define some text to show the user if no data was retrieved by the query. But there are other ways to determine if data was retrieved which you can use to control other ways to display this information. For instance, I have a page that has an outputText component that has a "rendered" attribute to show the text only when there was no data retrieved by a query.

  • : "Invalid object name '#Temp'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

     Hi   .
        I was creating the  pass the values t in temp tables  though s sis package vs2012 .
      First I was taken on executive SQL TASK.
     IN EXCUTIVE SQL TASK  . I was write the stored proce:
    Sp;
    reate  procedure  USP_GETEMP2333
    AS
    begin
    Select  eid,ename,dept,salary from emp
    end;
    create table #temp(eid int,ename varchar(20),dept varchar(20),salary int)
      insert into #temp
       exec USP_GETMP02333
       go.
     It was executive correctly.
     I was taken another sequence container. In the sequence container iam creating one   executive  sql
    In 2<sup>nd</sup> excutive sql task: sql statements is
    if object_id('emp_fact_sal') is not null
     drop table emp_fact_sal
    select eid,ename as emp_name,sal_bar=
    case when salary<=5000 then 'l'
    when salary >5000 and salary<=7000 then 'm'
    else
    'h'
    end
    into emp_fact_sal from #temp.
     and one falt flies  it was taken to designation .
     iam changing  all  connection properties:
     in oldeb connection:
    in excutive sal task properties .
    delay validation is true,
    and retain connection maner is also true,
    and package mode is 64 bit is false.
     But iwas excutive in 2<sup>nd</sup> excutive ql task .
    Iam getting this type of errors,
                    [Execute SQL Task] Error: Executing the query " if object_id('emp_fact_sal') is not null
     drop ta..." failed with the following error: "Invalid object name '#Temp'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established
    correctly.
     Please help me

    Arthur suggestion works but you shouldnt even be doing this on a SQL Task.
    Use a data flow task. You'll have better control over the data that is being transfered and get better performance because no staging table will be used.
    Just because there are clouds in the sky it doesn't mean it isn't blue. But someone will come and argue that in addition to clouds, birds, airplanes, pollution, sunsets, daltonism and nuclear bombs, all adding different colours to the sky, this
    is an undocumented behavior and should not be relied upon.

  • Query sql with parameters

    Hi. I create a ViewObject with the query
    SELECT Tblagenda.idagenda,
    Tblagenda.data_agenda,
    Tblagenda.dono
    FROM TBLAGENDA Tblagenda
    WHERE Tblagenda.idagenda = ?
    Please, how to setup the query parameter in runtime? Somebody could show me a example or tutorial?
    I´m using MySQL.
    Thanks

    Hi,
    this is what we have developer guides for. Please have a look at bind parameter usage in
    http://download-uk.oracle.com/docs/html/B25947_01/toc.htm
    Frank

  • Best way to keep parameters associated with Listobject query table?

    I'm working to establish a standard approach to retrieving data from SQL server databases into Excel based applications.  My current proposed structure allows for exactly one Listobject with a query table per sheet in a workbook.  The connection
    strings and SQL texts for all queries in the workbook are kept in a single table on its own (hidden) sheet.  Each "Datasheet" then has a table and named cells QueryName, ConnectionString and SQLText which are scoped at the sheet level.  The
    connection string and raw SQLText are retrieved from the table using QueryName as an lookup value into the QueryTable.  There are a series of parameter cells whose values are inserted into the SQL text using =Substitute() formulas, where the raw query
    text has #P1#, #P2#, etc, which are subsituted with the parameter values from the parameter cells to assemble the final query text in the named cell SQLText.  To refresh the application, a simple VBA Sub iterates through all the sheets in the workbook.
     If the sheet contains a ListObject with a Querytable, then ConnectionString and SQLText are written to the .Connection and .CommandText properties of the QueryTable and the table is refreshed.
    This works great, but I have a developer who has asked to be able to put multiple Listobjects with querytables on a single sheet so he doesn't need so many sheets in the workbook.  My first though was why do you care how many sheets you have, but on
    the other hand a single sheet can certainly handle more than one ListObject, so... 
    If you're still with me, THANKS!  Here's the question.  If I have more than one ListObject on a sheet, I'll need a ConnectionString and SQLText cell for each one.  How do I keep them associated?  I could require the developer to name
    them ConnectionString1/SQLText1, ConnectionString2/SQLText2, etc. and then expect that ListObject(1) goes with ConnectionSTring1/SQLText1, etc. but I'm not sure that the ListObject index numbers will stay constant.  I could somehow link to the table name,
    but that can be changed...  Any ideas?  If this is too general a question, feel free to ignore.
    Thanks,
    J

     I could somehow link to the table name, but that can be changed...  Any ideas?
    Not sure if this will help or not but maybe a little from several areas might point you in the right direction.
    If you are concerned about users changing the table name then you can define a name to reference the table and then if the user changes the table name then the Refers to automatically changes to the new table reference but your defined name remains the same.
    However, if users want to break a system even when you think you have it bullet proof the users come along with armour piercing bullets.
    Example:
    Insert a table (say Table1)
    Go to Define a name and insert a name of choice (eg.  ForMyTab1)
    Then click the icon at the right of the Refers to field and select the entire table including the column headers and it will automatically insert something like the following in the Refers to field.
    =Table1[#All]
    Now if a user changes the table name then Table1 will also automatically change.
    Example code to to reference the table in VBA.
    Sub Test()
        Dim wsSht1 As Worksheet
        Dim lstObj1 As ListObject
        Set wsSht1 = Worksheets("Sheet1")
        Set lstObj1 = wsSht1.ListObjects(Range("ForMyTab1").ListObject.Name)
        MsgBox lstObj1.Name
    End Sub
    Regards, OssieMac

  • Help on performance with dynamic query

    Hi All,
      We are using SQL Server 2008R2. In our one of report we are using Dynamic query and it is taking more time to retrieve the data. to retrieve 32 records it is taking 13-15 secs. In my observation in a table variable, created more than 60 columns. In
    the SP called one more sp with insert statement.
    Please let me know how i can improve performance of the SP.
    I know that i have to provide the SP  for observation but unfortunately I cannot provide the SP. Please guide me how i can achieve this .
    I tried with temp tables by creating indexes on temp tables but i couldn't find improvement in performance. 
    Waiting for valuable replies.

    First of all a "dynamic query" is not "a query" - it is a multitude of them. Some of them may be fast, others may be slow.
    There is of course no way we can give specific suggestions without seeing the code, the table and index definitions etc.
    We can only give the generic suggestions. As for the code, make sure that you are using parameterised SQL and you are not building a complete SQL string with parameters and all. If nothing else, this helps to make the code more readable and maintainable.
    It also protects you against SQL injection. And it also helps to prevent performance issue due to implicit conversion.
    You will need to look at the query plan to see where the bottlenecks may be. You should look at the actual query plan. Note that the thickness of the arrows are more relevant than the percentages you see; the percentages are only estimates, and estimates
    are often off. Next step is to see if you can add indexes to alleviate the situation. You should also analyse if there are problems in the query, for instance indexed columns that are entangled in expression. If you are using views, make sure that you don't
    have views built on top of views etc. This can often result a table appearing multiple times in a query, when one would be enough.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Calling stored procedures with parameters with the Database Connectivi​ty Toolkit

    Hi all,
    I am new to the forum and am having difficulty finding a solution to a particular problem I am having regarding using the LabVIEW Database Connectivity Toolkit on a project I am currently working on at my job.  I have a database in which I have tables and stored procedures with parameters.  Some of these stored procedures have input, output, and return parameters.
    I have been trying to follow this example but to no avail:  http://digital.ni.com/public.nsf/allkb/07FD1307460​83E0686257300006326C4?OpenDocument
    One such stored procedure I am working on implementing is named "dbo.getAllowablePNs", which executes "SELECT * from DeviceType" (DeviceType is the table).  In this case, it does not require an input parameter, it has an output parameter that generates the table [cluster], and has a return parameter which returns an integer value (execution status code) to show if an error occurred.  The DeviceType table has 3 columns; ID (PK, int, not null), PN (nvarchar(15), null), and NumMACAddresses (int, null).  I have gone over many examples and have talking to NI support to try to implement this and similar stored procedures in LabVIEW but have not been successful.  I am able to connect to the database with the Open Connection VI without error, but am running into some confusion following this step.  I am then trying to use the Create Parameterized Query VI to call the stored procedure and set the parameters.  I assume I would then use the Set Parameter Value VI for each parameter that is wired into the parameters input on the previous Parameterized Query VI?  I am also having some confusion during and following these steps as well.  I would greatly appreciate any advice or suggestions anyone might have in regards to this situation as I am not a SQL expert.  Also, I would be happy to provide any more information that would be helpful.
    Regards,
    Jon
    Solved!
    Go to Solution.

    Also, I don't know if this would be helpful but here is the actual stored procedure in SQL:
    CREATEPROCEDURE [dbo].[getLastSequenceNumber]
    @p1 nvarchar(10)='WO-00000'
    AS
    BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SETNOCOUNTON;
    -- Insert statements for procedure here
    selectmax(SequenceNumber)from Devices where WorkOrderNumber= @p1
    END
    GO

  • Discoverer report with parameters and functions

    I am new to Discoverer. Is there a way to create a report (with parameters) of one line per customer such that the following data will be displayed for each customer?
    Among the parameters is: from_date (month & year) ,to_date
    The basic query gives totals for each date (month & year) for every customer.
    Among the fields displayed:
    1-customer_id,
    2-balance until from_date,
    3-total activity between from_date and to_date
    I have a function to calculate the total balance until from_date, but then I cannot get the total activity on the same line. I tried using another function and I tried using a total calculation but to no success.
    Is this possible?
    Thanks.

    Hi Markus
    You need to determine whether you can in fact call a Discoverer report using a URL before linking it in Portal. You need to run the report in Viewer first and then see copy the URL from the address line of the browser. Then you open another browser and paste the URL. You may well be prompted for a username and password but hopefully the correct report with the right parameters will then execute.
    Assuming this works you then paste the same URL link into Portal and you should be able to get the report to run.
    Best wishes
    Michael

  • How do you have more than one parameterized Query to display "All"?

    hi,
    I am using:
    Jdeveloper 9.0.5.2
    Oracle Database 9.2.0.1
    Toplink
    Struts
    I have been able to create a parameterized query to display an html read only table.
    I populated a dropdown list with values from the database
    and the values I select will be the parameters to my read only table.
    The drop down list is on the same page as the read only table.
    I have all this working but I also need to hard code an option in the Drop down to "All"
    to represent all values of this parameter.
    I was able to trick the jsp page using two read only tables
    and displaying the one with the parameterized query when a parameter other than "All" was chosen
    and then display the other only when "All" was chosen.
    This does not seem the best way to do it.
    What if I had more than one parameter and I wanted to show "All"
    the values of one and a certain values for another.
    I would then need at least 4 read only tables.
    How do I accomplish this in an easier way?
    Thanks in advance.

    I am not exactly sure what you are asking... Are you having trouble with TopLink, or another part of your application?
    Peter Krogh

  • List view - filter with parameters

    Hi,
    I need to define a list view to filter data with parameters.
    I saw how to do it with the SPD in another post
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/92271aa4-6582-4ea5-a10f-deaf02d2b62c/filtering-the-list-view-by-passing-date-parameters-using-sharepoint-desginer-2010?forum=sharepointcustomizationprevious
    But  need to do it in visual Studio (via definitins or Object Model).
    How can I do that in Visual Studio?
    Help is really appreciated.
    Many thanks,
    DD

    Hi,
    According to your description, you might want to create a list definition with the filter value from query string from URL. Then when you create a list instance with this list
    definition, you will be able to filter the list view page by appending parameters to the URL in the address bar.
    You can achieve this through modifying the Schema.xml file in the list definition project in Visual Studio like this:
    How to create custom list definition
    http://msdn.microsoft.com/en-us/library/office/gg276355(v=office.14).aspx
    http://www.codeproject.com/Articles/412429/SharePoint-Create-List-Definition-and-Instanc
    CAML Query Schema
    http://msdn.microsoft.com/en-us/library/office/ms467521(v=office.15).aspx
    Then we can filter the list with such an URL:
    http://sp/Lists/List1/AllItems.aspx?Param1=2014-08-24&Param2=2014-08-28
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

Maybe you are looking for

  • Help: contacts won't download/sync from Mobile Me to iPhone?

    My new iPhone won't download old contacts from MobileMe. It will sync any new contacts or calendar event I add to either the iPhone or Mobile Me, but not the existing ones. Basically, I bought my first iPhone a couple of days ago. I just followed the

  • How can I create a "master" document with multiple variations?

    I designed a map that will be posted at a few dozen junctions with a "you are here" symbol.  Every one will be identical with the exception of this symbol.  I don't know if there is any way to do this while preserving a "master" map that can be edite

  • Can not login into itunes store bummer

    CAn't connect to the itunes store either, lukely i am not the only one.

  • Search For Advance Table

    Hi All, I have to implement custom search similar to seeded competency search. But the requirement is the search criteria will be decided by custom components like choice bean, list bean. Once I capture the these values from listbean and ChoiceBean i

  • Opening Spreadsheet files in LabView

    I'm attempting to read spreadsheet files into a LV application. Spreadsheet files that were not written in LV contain garbled data. Similar to wingdings. Spreadsheet files that were written/saved in LV open without wingdings in the format that it was