Question
· Oct 22, 2019

How to call a class query from .NET client application

Hello!
There is a class query “MemberStatusList” in the SYS.Mirror class that I would like to call from a .NET client application. 
I know that means that there is also a generated class method called MemberStatusListFunc. 
What is the best way if any exist to call them from a .NET application?
Just see if anything responded I tried using something like

IRIS iris = IRIS.CreateIRIS(conn);
var returnValue = iris.ClassMethodString("%SYSTEM.Mirror", "MemberStatusList", "NAMEOFTHEMIRROR")
---
That executes the method and returns the reference as a string to a %SQL.ClassQueryResultSet.
Obviously I would like to have a recordset of some sort to itterate so that call will not work for me.
I looked at using IRISCommand but I cannot figure out how to call the class query.
Is this doable or should I look for another solution?

(the cache database is in a Healthshare HealthConnect 2019.1 installation)


Best regards,
Magnus

Discussion (4)1
Log in or sign up to continue

Hello Magnus,

I recommend  that you use a SQL CALL instead of IRIS Native for .Net.

The following CALL query should work: CALL SYS.Mirror_MemberStatusList('NAMEOFTHEMIRROR') and this is no different than using a stored procedure (because MemberStatusList is a class query).

If you do not have a connection to %SYS where SYS.Mirror exists , but the user for your existing connection does have privileges to access %SYS, you can write a wrapper stored procedure something similar to:

CREATE PROCEDURE MirrorMemberStatusList(IN MirrorName %String) RESULT SETS LANGUAGE OBJECTSCRIPT
{
:#Include %occResultSet
    new $NAMESPACE
    set $NAMESPACE="%SYS"
    $$$ResultSet("CALL Sys.Mirror.MemberStatusList('" _ MirrorName _ ')")
}