Written by

Lead Technical Analyst at Missouri Health Connection
Question Scott Beeson · Feb 11, 2016

Ens.Rule.FunctionSet without parameter?

I'm writing some custom functions for use in a routing rule.  I have a few that are working, but right now I'm trying to use one that has no parameters.  Typically this would be a sub instead of a function, but I'm not familiar enough with Cache to know what I need to do here. 

Here is the code:

Class Custom.MHC.Common.CustomFunctions Extends Ens.Rule.FunctionSet
{
   /// Location and Revision of this file in Perforce (Auto-updating)
   Parameter SrcVer = "$Id$";
   /// Returns the current environment code,
   /// DEVELOPMENT, TEST, LIVE
   ClassMethod getEnvironment() As %String [ Final ]
   {
    ^%SYS("SystemMode")
   }
}

And here is what happens in the Rule Editor UI:

What should I do?  

Comments

Scott Beeson · Feb 11, 2016

It seems to function fine, but the ( ! ) bothers me.

0
David Loveluck · Feb 11, 2016

the UI here is not very clear - it suggests that you need an argument, but leaving the box empty should work just fine. No argument will be passed and everything will work fine.

0
Scott Beeson  Feb 11, 2016 to David Loveluck

Thank you David.  Would it be preferred, or is it even possible, to reference ^%SYS("SystemMode") directly somehow?

0
Scott Beeson  Feb 11, 2016 to David Loveluck

And I suppose I could just pass a zero to avoid the warning indicator.

0
David Loveluck · Feb 11, 2016

looking at the 2016.2 field test, the red exclamation mark has gone. It normally means the argument is required, so it shouldn't be there, but is doing no harm other than misleading people.

0
Scott Beeson  Feb 11, 2016 to David Loveluck

Good to know it's fixed in a newer version.  I'll do my best to ignore it! :)

0