Scott Beeson · Jan 21, 2016

[QUESTION] Will I still be able to use these methods from business rules without the [ Final ]?

I'm working on some custom utility functions that I can utilize in Business Rules as well as other places.  I saw this line in the docs:

For each function you wish to define, add a class method to your new function set class. There is no support for polymorphism, so to be precise, you must mark these class methods as final.

 but I didn't really know what it meant.  I didn't run into any problems until I tried calling one of my new methods from another method.  Removing the [ Final ] fixed the issue, but I'm guessing that means I can't call them from Business Rules now?

Any clarification would be appreciated.  And just in case, here are the two methods in question:

ClassMethod stripTestFlag(iString As %String) As %String
    if $FIND($ZCONVERT(iString,"U"),"-T")
        set iString = $PIECE(iString,"-T",1)
        set iString = $PIECE(iString,"-t",1)
    q iString

/// Returns the participant code based on MSH-4
ClassMethod getParticipant(iSendingFacility As %String) As %String
    set = ..stripTestFlag($PIECE(iSendingFacility,"^",1))
    set = ..stripTestFlag($PIECE(iSendingFacility,"^",2))
    set sc1 = ..Lookup("ParticipantCodeMap",a)
    if sc1 = "" {
        set sc1 = ..Lookup("ParticipantCodeMap",b)
    q sc1


Again, when I had [ Final ] and tried to call getParticipant() it threw an error on the q iString line of the stripTestFlag() method.  Once I removed [ Final ] from both it worked fine.

0 2 135 0


Final method or not it checks only in a compile time.  Much helpier would be if you show an error which you get. 

I haven't gotten to the point where I'm trying these from Business Rules yet, I was just worried about it saying that I "Must mark them as [final]" but not being able to chain them without removing that.

I will continue working on it and if I do get an error when I get to that point I will post it.  If I don't, I guess I'll ignore the statement above.