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?  

0
0 387
Discussion (6)1
Log in or sign up to continue

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

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.

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

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

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.

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