Question
· Jul 16, 2019

Correct usage of %Library.ListOfObjects containing EnsLib.SQL.Snapshot in Ensemble

I'm having trouble accessing the snapshots  EnsLib.SQL.Snapshot in %Library.ListOfObjects that are returned from method ExecuteProcedure in EnsLib.SQL.OutboundAdapter.  The Microsoft SQL stored procedure I am executing returns multiple resultsets.

The issue I am having is that my code works fine when executed in the business operation (commented out in the code below) but when it is executed in the business process it errors.  Any ideas as to why this happens?  The error I get is:

> ERROR #5002: Cache error: <METHOD DOES NOT EXIST>zGetAt+5 ^%Library.ListOfObjects.1 *%Open,%Library.RegisteredObject

The trace statements log the following in the business process:

Object: 11@%Library.ListOfObjects

Size: 2

Count: 2
 

Classes below:
Class Test.Operations.SQL Extends Ens.BusinessOperation

Parameter ADAPTER = "EnsLib.SQL.OutboundAdapter";

Property Adapter As EnsLib.SQL.OutboundAdapter;

Parameter INVOCATION = "Queue";

Method Testing(PREQUEST As UHSM.Messages.Test, Output PRESPONSE As %Library.ListOfObjects) As %Status

{

       Set query="{call dbo.spTIE_Test(?)}"

       Set sc = ..Adapter.ExecuteProcedure(.PRESPONSE,.outparams,query,"i",PREQUEST.RM2Number)

       // The following works correctly when executed here     
 //    While(PRESPONSE.GetNext(.x)) { 
 //        Set snap = PRESPONSE.GetAt(x)
 //         While(snap.Next(.sc)) {             
 //             $$$TRACE("Surname: "_snap.Get("Surname"))
 //         }
 //     }     

       Quit sc

}

XData MessageMap

{

<MapItems>

       <MapItem MessageType="UHSM.Messages.Test">

             <Method>Testing</Method>

       </MapItem>  

</MapItems>

}

}

 

 

Class UHSM.Processes.Test Extends Ens.BusinessProcess

{

 

Method OnRequest(pRequest As Ens.Request, Output pResponse As Ens.Response) As %Status

{

       set sc=$$$OK

       Set sc = ..Testing()

       Quit sc

}

Method Testing() As %Status

{

       Set req = ##CLASS(UHSM.Messages.Test).%New()

       Set req.RM2Number = "1212312"

       Set sc=..SendRequestSync("Test SQL",req,.resultSet,20)

       $$$TRACE("Count: "_resultSet.Count())

       $$$TRACE("Size: "_resultSet.Size)

       $$$TRACE("Object: "_resultSet)

       $$$TRACE(sc)

       While(resultSet.GetNext(.x)) {

             Set snap = resultSet.GetAt(x)

              While(snap.Next(.sc)) {                

                    $$$TRACE("Surname: "_snap.Get("Surname"))

              }

       }     

       Quit sc

}

}

Thanks,

 

Graham

Discussion (2)0
Log in or sign up to continue