Both the business and users are always looking to enhance validations on planning forms and business rules one way to do this is using the RETURN function. Starting with 11.1.2.1 release of EPM we got a new Calc Script function added ‘@RETURN’ the Essbase Tech Reference defines this as “ Exits the calculation immediately under specified logical conditions. You can use the IF... ELSEIF calculation command block to specify the logical error conditions, and use the @RETURN function to exit the calculation with customized error messages and levels”
Well that definition is great and gives us an idea of what
the function does, it doesn’t tell us a good way to use it. Over the last
couple of years I have encountered some great use cases, and I think this is
the time to share those.
- User confirmation on rule run
- Member validation on RTP
- Input validation
- Rule run confirmation output
In all of these use cases the key thing to note is that it’s
not the syntax of the @RETURN function that’s key, it’s how it’s used in
conjunction with the rest of your application.
IF (
@hspstringcompare({RTP_AreYouSure}, "YES"))
@RETURN("You
were sure!",ERROR);
ELSE
@RETURN("Unsure
were you?",ERROR);
ENDIF
In your real use of this, you would obviously replace the “you were sure!” error with some more code to execute, or change the’ if’ around so that it only traps the exit condition.
IF (not @ISMBR("Plan"->"Working"))
@RETURN("You
must select the Plan Scenario and Working Version to run calculations",ERROR);
ENDIF;
I recommend
making this a separate rule at the start of the ruleset, but you could put it
at the top of your existing rule.
IF (acct1001 > 500)
@RETURN(“Value
input in acct1001 must not exceed 500”,ERROR);
ENDIF;
@RETURN(@CONCATENATE(@CONCATENATE(@CONCATENATE(@CONCATENATE(@CONCATENATE(@CONCATENATE(@CONCATENATE(@CONCATENATE(@CONCATENATE("Data
is only moved for selected year, please run for future years if. Rule was run
for Jobcode:",@NAME({RTP_Rev_Program}))," From:"),@NAME({FromOU})),"
To:"),@NAME({ToOU}))," For "),@NAME({FirstMonth}))," To Jun
of "),@NAME({FirstYear})),ERROR);
The resulting message in this case would look something
like this:
Well as promised at the beginning of this post, that’s 4
different uses of the function, it should be noted that these are not all of
the different ways that you can use RETURN, and that you can easily combine
many of these uses in a single rule, but remember, once the function is called,
the rule will stop.
One final benefit, since this function will show as an
error, you can reference back into the job console to see a history of where
the messages have been shown in the details of the error, this can be helpful
for identifying user behavior ( too many error messages in the console may even
mean additional user training may be useful) , or just as an audit to ensure
that conditions are applied correctly.
I have presented 4 use cases here, if you have more
please leave a comment, I would love to hear how others are also using this
function. Well it’s time for me to return back to doing ‘real’ work, hope this
helps you, until next time.
-Dan
Comments
Post a Comment