Announcement

Collapse

Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Accessing result set without iterating it

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Accessing result set without iterating it

    Hello all,

    I have two resultsets in my javascript code and the the second one should use the first one like this:

    First resultset:
    Code:
    var queryNarkosenStammdaten=(<r><![CDATA[ SELECT DISTINCT z.Fallnummer, z.Protokollnummer,...]]</r>«»).toString();
    var resultNarkosenStammdaten = dbConn.executeCachedQuery(queryNarkosenStammdaten);
    Second resulset:
    Code:
    var resultAnamnesestr=dbConn.executeCachedQuery("SELECT DISTINCT ... WHERE...= +resultNarkosenStammdaten.getInt("Protokollnummer"«»));
    When the second query tries to access the first resultset I get the error
    Code:
    DETAILS:	Wrapped java.sql.SQLException: Invalid cursor position
    Do you know how to access a resultset without iterating it? Is there a function that converts JS result set to a "usual table" ?

    Thanks a lot!

    Svetlomir

  • #2
    Re:Accessing result set without iterating it

    A few things.

    I think you might not be building your second query correctly, try:
    Code:
    var resultAnamnesestr=dbConn.executeCachedQuery("SELECT DISTINCT ... WHERE...= " + resultNarkosenStammdaten.getInt("Protokollnummer"«»)" + "«»);";
    Do you get the execption if you just do this:
    Code:
    var dummyvar = resultNarkosenStammdaten.getInt("Protokollnummer"«»)
    Jon Bartels

    Zen is hiring!!!!
    http://consultzen.com/careers/
    Talented healthcare IT professionals wanted. Engineers to sales to management.
    Good benefits, great working environment, genuinely interesting work.

    Comment


    • #3
      Re:Accessing result set without iterating it

      Hi jbartels,

      I got the same error on the both of the code samples I tried.

      Code:
      DETAILS:	Wrapped java.sql.SQLException: Invalid cursor position
      It seems like the cursor for the resultset is initially at 0. I should use resulset.next() to set it to 1 and then i can get the value from the first row of the resutset.Then with resulset.next() I can get values from the second row and so on... But I can't access the resultset as a regular DB-table. I can't get directly the values for example from the 6 segment - I should always use next() to get to it. Thats the downside of Javascript

      Svetlomir

      Post edited by: Svetlomir Kasabov, at: 09/19/2008 12:46

      Comment

      Working...
      X