Dynamic Scripting Validation Goodness

With the arrival of Dynamic Scripting in DRM 11.1.2.3, JavaScript is a valid scripting option within DRM. This is pretty neat because a script provides a more robust alternative to traditional DRM formulas. I also like the fact that you can now put comments inside your code. I thought it would be nice to do a simple use case of this technique. In this case, I thought we would create a simple validation with Dynamic Scripting logic.

But first, I suppose we need some suitable dynamic scripting music.

The validation I have in mind is a simple one…check whether the number of characters in a description exceeds 80. On a side note, I was wondering why there is usually an 80 character limit on coding width standards? Apparently this hearkens back to the IBM punch card days.

I guess I could create a simple one like this without the use of dynamic scripting:

4_1_Validation

Well that’s efficient enough…but what if I wanted to extend this to also validate whether the user forgot to add a description? Now, we either need another validation or a property or a query that would check whether:

  1. The description is empty?
  2. The length of the description exceeds 80 characters?

Enter dynamic scripting.

Firstly, I’ll create a validation with the class, Script. Now, let’s declare a couple of variables (Notice how existing properties can be called from within variables?):

Now, we add some logic to check whether the description is greater than 80 characters:

The “print” function is useful because it allows you to do some troubleshooting within the scope of the validation. Now we at least know that our code is working.

4_2_Print

And if we need to check another condition? Very simple and very similar to any other scripting solution you’ve use in the past.

Finally, we’ll add one last snippet of code.

And a quick check whether our syntax is accurate:

4_3_Code_Check

Great, so now that all of that works, there is one last piece to the puzzle before we add this validation to a hierarchy. How do we set up a failure message so that we can get the parameterized messages to the console? That’s pretty simple too. All you need to do is put the following code in the Failure Message box.

4_4_Failure

Now, we’ll attach the validation to a hierarchy and run the validation.

4_5_Validation_Fail

Let’s check the messages that popped up.

4_6_Validation_Messages

So as you can see, dynamic scripting is a powerful new addition to the DRM stack. There are so many uses one can think of for it. There will be other posts devoted to dynamic scripting in the future, so keep checking in from time to time.

About Vijay Kurian

Known as the Clem Fandango of EPM consulting, Vijay Kurian has been developing enterprise solutions for companies for the last 12 years (increment years if reading post-2015). Having worked with Essbase, Planning, DRM and other assorted technologies during that time, he’s made the frankly, average decision, to write about them. He hopes to contribute frequently to US Weekly, People and Sensible Chuckle magazines on improving reporting solutions, creating master data management systems and zzz…

2 Comments

  1. Thank you very much Vijay, the customised message for validation failure was causing me headaches.

  2. Nice post Vijay.. The good thing is you are sharing interesting things.. eagerly waiting for your future posts regarding java script.

Leave a Reply

Your email address will not be published. Required fields are marked *