User bio
Have a little Mumps experience from before Cache, but mostly a C/C++ developer (and the follow-on technologies like Perl, Java)
Member since Dec 8, 2015
Posts:
James has not published any posts yet.
Replies:

Examples of calling a function from csession, and setting DocType ad hoc:

ENSEMBLE>do ##class(UMMS.UMMC.HL7.ALL.RouterRoutines).SetDocTypeId( "40382754","2.3:ORM_O01")
/// note: quotes around the msgId don't seem to be necessary. Cache casts num to string?
/// Also, the shorter version of above is:
/// ENSEMBLE>set oref=##class(EnsLib.HL7.Message).%OpenId(40382754)
/// ENSEMBLE>s oref.DocType = "2.3:ORM_O01"  
/// ENSEMBLE>w oref.DocType
/// 2.3:ORM_O01
/// ENSEMBLE>do oref.%Save()Examples of calling ad hoc:

...where msgId is the first number listed in the Message Viewer Contents panel.

Class UMMS.UMMC.HL7.ALL.RouterRoutines Extends Ens.Rule.FunctionSet
{

ClassMethod SetDocTypeId(pMessageId As %String, pDocType As %String) As %String
{
    set $ZTRAP="SetDocTypeIdError"
    set oref=##class(EnsLib.HL7.Message).%OpenId(pMessageId)
    if '$IsObject(oref) {
        &js<document.all.display.innerHTML='Unable to open HL7 message';>
        quit
    }
    s oldDT = oref.DocType
    s oref.DocType = pDocType
    // the next call doesn't seem to be necessary unless we are running from the terminal
    // (at least as long as the production isn't bounced!)
    do oref.%Save()
    
    // only see in router's log if trace is enabled 
    $$$TRACE("ROUTER TESTING:: Was able to set old oref.DocType ["_oldDT_"] to new ["_oref.DocType_"] from passed in ["_pDocType_"] for msgID ["_pMessageId_"] ...\n")
    
    Quit 1

SetDocTypeIdError
    set $ZTRAP=""
    If $ZE $$$LOGERROR("$ZE: "_$ZE) //test unnecessary but ...
    $$$TRACE( "error setting ID doctype ["_pDocType_"] for ID ["_pMessageId_"] ... \n\n" )
    quit ""
}

}

Followers:
James has no followers yet.
Following:
James has not followed anybody yet.
Global Masters badges:
James has no Global Masters badges yet.