Retrieve Query Results in Javascript

Hi,
I've created a SQL query template with Param.1.  I've created and iCommand for it.  I've also created an Applet consisting of the SQL Query and iCommand template.
I am trying to retrieve query results after setting the parameter.  I am getting errors (undefined of course) when using the getValue() method. 
1. var commandObject = document.AppName.queryobject;
2. commandObject.setParam(1, var1).  var1 = 'Training'
3  applet refresh
4.  var var2 = commandObject.getValue(1,1) ==> crashes. 
5.  alert (var2);
This seems pretty straight forward.  Any ideas?
Thanks

kelly
Just missing one javascript code <b>iCommand.executeCommand();</b>
1. document.AppName.getqueryobject().setParam(1, var1) ;
2. document.AppName.executeCommand();
3. var var2 = document.AppName.getValueByName(String ColName, 1);
5. alert (var2);
Regards
Som

Similar Messages

  • Need help on retrieving query result - NPE

    Hi, I could get results with the native query in my TOAD, but I can't get it working in my session EJB. I tried both native query and EJB ql. The query created fine, as soon as I try to retrieve results, it gets stuck.
    My native query looks like this:
    Query query = em.createNativeQuery("select sum(o.amount_reimbursed) from t_expenses o where o.employee_id = '999999911' " +
    "and o.EXPENSE_ID in (select p.expense_id from T_Per_Diem_Xref p where p.expense_Type_Xref_Id=22 " +
    "and p.expense_Id in (select e.expense_Id from T_Expenses e where e.employee_Id='999999911' " +
    "and e.expense_date > to_date('01/01/2011', 'mm/dd/yyyy') and e.expense_date < to_date('12/31/2011', 'mm/dd/yyyy')))") ;
    My EJB query looks like this:
    Query query = em.createQuery("select sum(o.amountReimbursed) from TExpenses o where o.employeeId = ?1 " +
    "and o.expenseId in (select p.expenseId from TPerDiemXref p where p.expenseTypeXrefId=?2 " +
    "and p.expenseId in (select e.expenseId from TExpenses e where e.employeeId=?1 and e.expenseDate>=?3 and e.expenseDate<=?4))");
    query.setParameter(1, employeeId);
    query.setParameter(2, expenseType);
    query.setParameter(3, fDay, TemporalType.TIMESTAMP);
    query.setParameter(4, lDay, TemporalType.TIMESTAMP);
    Either one, I get NPE at the line retrieve result.
    // sumAmt = (Double)query.getSingleResult();
    List list = query.getResultList();
    if (list != null) {
    long longAmt = (Long)list.get(0);
    sumAmt = (Double)list.get(0);
    As you can see, I tried to getSingleResult, or getResultList. also tried to convert the result to Double or Long. None worked.
    Please help and thank you for your time.
    Sophia

    Frank, thank you for your reply. I have this code in my session Facade EJB, and I get the NPE in my backing bean which calls this method. When I debug the code, it appears what really cuases the problem is in this code on the line I try to assign the query result to my variable 'sumAmt = (Double)query.getSingleResult();'. In the debug, when it reaches this line, it starts to give me all kinds of pop-up windows saying couldn't find this file or that file or packages. If I get a stack trace later, I will post it. Right now I am trying to fix something else.
    Thanks, Sophia

  • How to obtain sql query result in JavaScript

    hello, i want to know if this is possible : i have a Javascript function that make this:
    var szPLANT = document.getElementById("hid_Plant").value;
       var szLINE = document.brs_Line.getSelectedItem();
       var cell = document.brs_Cell.getSelectedItem();
       var GetLineDownload = document.GetLineDownload.getQueryObject();
       document.GetLineDownload.getQueryObject().setParam(1,szLINE);
       document.GetLineDownload.getQueryObject().setParam(2,cell);
       document.GetLineDownload.executeCommand();
    but i to catch the result of the sql ...to use in another things in this function...how to to this?..like this:
    result = document.GetLineDownload.results
    regards
    Mário

    Mario,
    your script suggests that you are using a iCommand query. The iCommand is used to execute a query that does not return a value, like an update, insert or delete query.
    If you are expecting a result, you would normally use an iGrid, and then you can use the functions that Suresh proposed to read out the result cells. If you do not want the iGrid to be displayed, but only need the values in your JavaScript, then you can omit the "DisplayTemplate" parameter in your iGrid so it won't be displayed on the web page.
    You can however read the values from the iCommand also by using the function "iCommand.getValue(Col, Row)".
    Please have a look at [http://help.sap.com/saphelp_xmii120/helpdata/en/44/d91ad2d06f3ee2e10000000a114a6b/content.htm].
    Michael
    Edited by: Michael Otto on Nov 13, 2009 1:25 PM

  • How do you use BOBJ SDK to retrieve the results of a query in XML

    I am trying to programatically get the results of a query given the query id
    My old code used BusinessObjects Enterprise Web Services API to  Retrieve a document's contents
    DocumentInformation biDocInfo;
    RetrieveData retBOData = RetrieveData.Factory.newInstance();
    Action[] actions = new Action[1];
    retBOData.setRetrieveView(xmlView);
    biDocInfo = rEngine.getDocumentInformation(queryId, null, actions, null, retBOData);
    (XMLView) biDocInfo.getView();
    Is there an equivalent way to retrieve the results of the query using SAP BusinessObjects BI 3.x Developer SDK Library ?
    Thanks for any information

    Hello.
    Are you wanting to use the BusinessObjects Enterprise SDK along with the Report Engine SDK as opposed to using the Web Services SDK that you were using previously?
    Also, what part of a webi document are you trying to get the XML format of?
    - Whole document
    - Single report within a document
    - Report page of a report
    - Report part within a report
    - All data providers
    - Single data provider
    If you are trying to use Business Objects Enterprise along with the Report Engine SDK, there are numerous samples for the various parts of the webi document that I mentioned above available at the following link:
    http://wiki.sdn.sap.com/wiki/display/BOBJ/JavaReportEngineSDKSamples
    I hope that this information helps.
    Regards.
    - Robert

  • Pass query result as parameter to javascript

    Hello,
    I'm a beginner with javascript, so (maybe) sorry for this
    question.
    Is it possible to use a query result as parameter in a
    javascript function
    for example like this?
    <cfquery name="select_data">
    select name from user_table
    </cfquery>
    <script language="javascript">
    function(#select_data.name#)
    </script>
    Background is: I have to validate an input field with some
    values which are saved in a database table.
    This values can be dynamic , so I don't want to put this
    values into the cfm-file.
    Any ideas?
    Claudia

    Each column in a cf query is effectively a 1D array. You can
    use the toscript function to send this array to js.

  • Retrieving BEx Query Results Area for use in Excel formulas

    Hello,
    I run BEx queries in workbooks and then use Excel formulas ( mostly VLOOKUP(LookupValue, ResultsArea, ColumnReturned,) ) to retrieve certain information from the query ResultsArea.
    ****Problem:
    Depending on the query parameters, the query "Results Area" is larger or smaller.
    ****Non-optimal solution:
    One way to define the  ever changing Excel range occupied by the Results Area is to create an Excel name as:
    QueryRange = OFFSET(QueryFirstCell,,,COUNTA(OFFSET(Sheet1!$A:$A,,COLUMN(QueryFirstCell)-1,,)),COUNTA(OFFSET(Sheet1!$1:$1,ROW(QueryFirstCell)-1,,,)))
    Then, the only input required is the top-left cell of the Results Area, which stays the same (unless the query definition changes).
    ****Question
    What is the best way to refer to an ever-changing query Results Area in an Excel formula?
    Thank you!
    Louis

    It is actually much easier than that.
    Use a VBA statement like the following:
    Set RptRng = ActiveCell.CurrentRegion
    This will retrieve the data in the Results Area, no matter what the size is.
    Hope this helps...
    Bob

  • Query Results: Retrieve All Rows?

    I was looking for a feature that will allow me to choose to return "all records" to the Query Results window. The current behavior is to fetch 50 records at a time (e.g. fetch 50 records as you scroll through the results = s-l-o-w). What I'd like to do is "Retrieve All Rows" then use to the scroll bar to "smoothly" scroll to the last record. For example, the 8.0.6 version of Query Builder had this functionality and in SQL Developer 3.0, if I right-click on the results. I can choose to "Count Rows...", seems like this would be a perfect place to put a "Retrieve All Rows" option.

    Hi,
    My advice: do something only if there is a business case for it; satisfying your curiosity can get surprisingly expensive.
    You have already read about using Run Statement to execute a SQL statement, then Ctrl-End to auto-scroll to the end. You can try the same for Run Script, but first you will probably need to increase the value of Tools|Preferences|Database|Worksheet|Max rows to print in a script. Of course, taking either of these approaches slows things down due to displaying output and scrolling. Same with SQL*Plus. And, as mentioned previously, Java memory management in SQL Developer can cause slow downs and hangs if the result set is large enough.
    Here is a way to minimize that delay, avoid hangs, and get a more repeatable result:
    1) Save some query to, say, C:\Temp\AllCustomers.sql. For example, "select * from customers;" or "select id from customers;".
    2) Run it from a SQL Developer worksheet using Run Script (F5), or from the SQL*Plus command line, with a script like this:
    set timing on
    set termout off
    spool C:\Temp\AllCustomers.lst
    @C:\Temp\AllCustomers.sql
    spool offEven then you will see that the timing results will vary. Maybe "select *" runs much slower than "select id" because the logical output lines are long and get wrapped into multiple physical output lines in the file. Minimize that by setting linesize to a longer value (but only in SQL*Plus -- it isn't supported in SQL Developer) and repeat the test to see. Maybe SQL*Plus runs it much faster than SQL Developer because one is a command line environment and the other a GUI tool with more overhead. Or maybe the SQL Developer JVM is near its size limit and lots of Java garbage collection is slowing it down. Simple question, complicated answer.
    Regards,
    Gary
    SQL Developer Team
    P.S.: And if by chance you are using a version of SQL Developer so old it does not include the output time in the query result tab's toolbar, using Run Script with set timing on is your only recourse.
    Edited by: gggraham on Oct 27, 2011 4:54 PM

  • Large query result set

    Hi all,
    At the moment we have some java classes (not ejb - cmp/bmp) for search in
    our ejb application.
    Now we have a problem i.e. records have grown too high( millions ) and
    sometimes query results in retrieval of millions of records. It results in
    too much memory consumtion in our ejb application. What is the best way to
    address this issue.
    Any help will be highly appreciated.
    Thanks & regards,
    Parvez

    you can think of following options
    1) paging: read only few thousands at a time and maintain a index to page
    through complete dataset
    2) caching!
    a) you can create a serialized data file in server to cache the result set
    and can use that to browse through. you may do on the fly
    compression/uncompression while sending data to client.
    b) applet based solution where caching could be in client side. Look in
    http://www.sitraka.com/software/jclass/cs_ims.html
    thanks,
    Srinivas
    "chauhan" <[email protected]> wrote in message
    news:[email protected]...
    Thanks Slava Imeshev,
    We already have search criteria and a limit. When records exceeds thatlimit
    then we prompt user that it may take sometime, do you want to proceed? If
    he clicks yes then we retrieve those records. This results in lot ofmemory
    consumtion.
    I was thinking if there is some way that from database I can retrieve some
    block of records at a time rather the all records of a query. I wander how
    internet search sites work, where thousnds of sites/pages match criteriaand
    client can move back & front on any page.
    Regards,
    Parvez
    "Slava Imeshev" <[email protected]> wrote in message
    news:[email protected]...
    Hi chauhan,
    You may want to narrow search criteria along with processing a
    limited number of resulting records. I.e. if the size of the result
    is bigger than a limit, you stop fetching results and notify the client
    that search criteria should be narrowed.
    HTH.
    Regards,
    Slava Imeshev
    "chauhan" <[email protected]> wrote in message
    news:[email protected]...
    Hi all,
    At the moment we have some java classes (not ejb - cmp/bmp) for
    search
    in
    our ejb application.
    Now we have a problem i.e. records have grown too high( millions ) and
    sometimes query results in retrieval of millions of records. It
    results
    in
    too much memory consumtion in our ejb application. What is the best
    way
    to
    address this issue.
    Any help will be highly appreciated.
    Thanks & regards,
    Parvez

  • Script for Save Options- Save Query Results with document

    Hi,
    Is there any javascript for Save query results with document in save options? If so where can i find that?
    Thanks
    Kalai

    hi guys,
    I found the answer.The following example shows you how to save the results with the query
    section named “SalesQuery”.
    ActiveDocument.Sections["SalesQuery"].SaveResults=true

  • Query Regarding Query Results in CMC 3.1

    Hi,
    I want to check what reports are scheduled in particular folder. To get this information we can use query builder by writing a query,but i don't have access to query builder.
    Can we check in CMC without access to query builder?I have seen one option In CMC 'Query Results'. What exactly Query results do and how to use.Can this be use to retrieve what reports are scheduled?
    Regards
    Ranjith

    Hi Ranjith,
    Query Results option in CMC is an application through which you could create Security Queries. It would help you identify the security setup and access being setup on the objects in your enviornment.
    Regards,
    Nakul Mehta

  • ODBC error occurred while executing SQLExtendedFetch to retrieve the result

    Good morning everyone,
    I had the following error message while trying to run a simple query in Answers with 3 dimensional columns, 1 fact, and 4 calculated facts...
    "State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 16001] ODBC error state: S1001 code: 0 message: [Oracle][ODBC]Memory allocation error.. [nQSError: 16011] ODBC error occurred while executing SQLExtendedFetch to retrieve the results of a SQL statement. (HY000)
    It's taking around 2,5 minutes to run, then it give that error message.
    Has anyone got any ideas on where I should get started?
    Update: after 2nd time - it's running fine....I've added a filter...could this be the issue? Too many rows initially?

    Damon,
    you were correct - it was indeed an ODBC issue. Switching to OCI has fixed the issue. This link was also very helpful:
    regarding performance
    In my case, the problem with OCI happened because I was using System DSN name instead of how it's called in tnsnames.

  • Still some 'Not Assigned' in query result

    Hi,
    In fact, I've built a query on a multiprovider ( 1 Cube + 1 ODS )
    The ODS and the Cube are joined by the material (0material).
    The Cube and the ODS are well filled. Queries on each Infoprovider correctly display the results.
    When I launch my query on the Multiprovider, it seems the "joined" between the 2 infoproviders doesn't work as
    I've still some '#' / 'Not Assigned' value in the query result, and it should give me a result.
    In fact the data from the ODS aren't retrieved, they are replaced by '#'. And I don't why ?
    Please help.
    Thx a lot,
    Erwan

    Yes you are right.
    I made a mistake in my explanation.
    But the problem is that the characteristics from the ODS aren't displayed though the characteristic from the cube are correctly displayed.
    eg.
    In the ODS I've :
    ( Material, ZCHAR )
    'ART01'  '315'
    'ART02'  '412'
    'ART03'  '999'
    In my Cube I've :
    'ART01'  '12,36€'  '59,00€' '30 ST' 
    'ART02'  '12,96€'  '89,00€' '40 ST' 
    In the query(on the multiprovider) result I've :
    ( Material, ZCHAR, other values...)
    'ART01' '#' 'Not assigned' '12,36€'  '59,00€' '30 ST' 

  • IN clause in DB Adapter doesn't retrieve any results

    Query builder in the Oracle Database Adapter doesn't give an option to include IN clause in the SQL. If I include that in the SQL directly say like the following
    SELECT COL1, COL2 FROM TEMP_TABLE WHERE COL1 IN (# VAR_CD)
    and I am passing 'Joe', 'Matt' to the VAR_CD parameter.
    This doesn't retrieve any result. If I pass only one value, say, 'Joe' to the parameter VAR_CD, it is fetching the result.
    I am not able to figure what goes wrong here.
    Can somebody please help me here.

    Hi, someone knows what could I do?
    After the Lollipop update my Music Index simple vanished. If I enter in the Music app, this only shows the sound effect of the camera.
    I tried to clean up and reset the Music app, I have tried to update this too, enters in the safe mode and I used another music app from another company, and every of them only shows this folder.
    The strange is that in the File Commander the music is there, and this can categorize the folder with musics.
    I don't know what could I do more. If someone have the same problem or know what could I do leave a message.
    Thank you

  • Error while sending query result

    Hi all,
    I am working on a JDBC-XI-IDoc scenario. In my sending JDBC adapter configuration, i have given the Query SQL statement as <b>SELECT * FROM SAP_PROMOTION</b> and Update SQL statement as: <b><TEST></b>
    But when i go to adapter monitor, i am seeing an error as follws:
    <b>Error:  Sending query result failed with com.sap.aii.af.service.cpa.impl.exception.CPALookupException: Couldn't retrieve binding for the given channelId: Binding:CID=875514bc047b3557a5b53dfb5ef4babe; - retry
      last retry interval started 10:54:09 2006-05-25
      length 60,000 secs</b>
    Can anybody help me how to solve this problem.
    Regards,
    Divija

    Divija,
    Am not sure if this is the exact cause for your problem, but would anyways suggest that you take a look at it,
    <i>classes12.zip is not compatible with JDK 1.4.</i>
    From the note : <b>831162</b>
    Oracle JDBC Driver (classes12.zip / classes12.jar) Deadlocks
    <b>Q: I have deployed the Oracle classes12.zip / classes12.jar JDBC driver as per the instructions in the XI Configuration Guide.
    Unfortunately, I frequently notice hanging database connections. A thread dump taken according to the instructions in note 710154 shows one or more blocking JDBC Sender/Reciver threads and optionally that the JVM has detected a deadlock.
    A: The Oracle classes12.zip / classes12.jar driver is compatible with Java 1.2 and Java 1.3 only, but not with Java 1.4. Please upgrade to a current driver (ojdbc14.jar), which does support the Java 1.4 JVM you are using.
    Please make sure that you remove classes12.zip / classes12.jar from aii_af_jmsproviderlib.sda prior to adding the new driver as per the instructions in the answer to question #1 above as you will get a class name collision otherwise (all JARs from aii_af_jmsproviderlib.sda are loaded into the same class loader and the driver class name of both driver versions is the same).
    Before deploying the updated driver, ensure that the new version is still compatible with your Oracle database server release. For details, please refer to the release notes provided by Oracle.</b>
    Regards,
    Bhavesh

  • Entity Attribute Existence Check - Query Result Parameter not possible ?

    I already read the section of the ADF BC Developer Guide (9.6.2 Implementing an Efficient Existence Check).
    That works and maybe is the best solution, however I am working with a group of Forms Developers which are much more comfortable with writing SQL statements.
    Natural thing for them in this case was to define a declarative compare validator with the following Query Result:
    select PROD_ID from Products where PROD_ID=:ProdId
    where :ProdId is ServiceRequest.ProdId
    Is this possible with ADF BC ?
    Other possibility is to define a List Validator with the following Query Result:
    select PROD_ID from Products
    but this is not performant.
    I know the programmatic approach is always possible, but to make migration easier for Forms developers into the ADF BC world, the declarative SQL option should be available.
    Thanks,
    Claudio.

    This isn't possible out of the box in 10.1.3 since we don't support a mechanism to set the values of the bind variables. In 10.1.3, you would need to build a custom validation rule class (explained in section 26.9 "Implementing Custom Validation Rules") to make this declarative for others on your team.
    I wouldn't recommend the list validator in 10.1.3 for anything but the most trivial uses. This is because it's current implementation retrieves all rows from the query, then does the attribute comparison in memory.
    Among many, many other enhancements, we are greatly enhancing declarative business logic features of ADF Business Components for our 11g/Fusion release (the next major release), where this will be super-easy.

Maybe you are looking for

  • JDBC Connection pool recovery after DB server restart

    I am finding that Kodo is throwing the following exception after I restart my database server (mysql). I am doing the database server restart while my application server is idle, so it is not during a transaction. Communication link failure: java.net

  • [request] Intel VTune Performance Analyser

    Hello, I am wondering if someone have made a pkgbuild for the Intel VTune Performance Analyser: http://www.intel.com/cd/software/produc - 239143.htm. At the moment I do not have the skills or time to make a PKGBUILD, so I am hoping that someone alrea

  • HT201412 Can't restore iPod 4th gen, HELP!!!

       Hi! I can't restore my iPod 4th gen. because it will not show up under "devices" on iTunes! I plug my iPod into my computer, and a little stop sign comes up telling me my iPod is locked with a passcode and needs to be unlocked. Heres the catch: my

  • Create characteristc with multiple units of measure

    Hello Friends, I want to create characteristic (CT04) which has multiple units of measure.  At present  a  Characteristic is created with a single unit of Measure. I have to create characeristic and assign it in MIC. MIC specifications are customer d

  • I am a professional photographer and I shoot only in raw.

    This may be a stupid question but why does my ipad upload pictures in raw+jpeg Thanks for you help in advance! Tonya