OPA 12 - Data Validation

Data Validation in Oracle Policy Automation

Some people assume that the only answer to a problem with my other favourite software (Oracle Siebel CRM) is to write some script. These days they mean JavaScript, jQuery, Web Services or anything else they can lay their hands on.

The same thing might happen one day with Oracle Policy Automation (and indeed, appears to be happening on an increasing basis). Let’s add some JavaScript! After all it’s just JavaScript, so what can go wrong? All JavaScript can do is pop up warnings and make text blink, right? Wrong. Before you know it you have altered (or at least attempted to interfere with ) the user experience beyond recognition, spent a lot of time and money and probably broken a few Oracle Policy Automation golden rules along the way.

So what has that rant got to do with Data Validation. Well, the other day a colleague and friend (thanks M!) came to me with a question and she was eager not to use JavaScript at all. She is learning some of the features of Oracle Policy Automation and she has the good reflex : think outside Scripting.

The question was, how to validate a data entry. The user must be able to enter between 1 and 100 characters in a Control, and the control can accept tabs, spaces, as well as certain accented characters (the language of data entry was not English). So what options does she have?

Error and Warning Rules for Data ValidationOPA 12 - Data Validation

Our rule designer could create rules that assist the user in at least understanding what they are doing wrong. They could also (assuming they are using at least a reasonably modern version, choose to have those error messages when the user navigates away from the Screen, or from the Control (Show Errors > Immediately or  On Navigate from the Interview tab Ribbon).

Attribute Type Specific Options for Data Validation

For attributes that are not textual – numbers, time of day, dates and so on, then there are a variety of further options that can be applied to the Attribute in the Modeller interface, on the Data tab.

OPA 12 - Data Validation 2

But our intrepid rule designer still didn’t get the level of fine detail she was looking for , in respect of her Text attribute. How to limit the  data input to only that specific set of characters?

RegEx in Data Validation

The most powerful form of Data Validation, and the one that benefits from a huge community of helpers, is Regular Expressions. They can be applied to Text Attributes and as such, can provide a high level of control. For the sake of your sanity, do check that the RegEx you are trying to use is compatible with the Oracle Policy Automation engines (Java and JavaScript – so as the official documentation says

“Be sure to only use regular expression syntax that is supported by both languages, and by all browsers. This is basically POSIX ERE regular expressions, with Perl/Tcl character classes. For more information, including examples on crafting regular expressions, see the Wikipedia article on Regular expressions.”

In the specific case mentioned above, our rule designer was able to use the Unicode values to create the range of characters for our character class. And she used our favorite site regexr.com to build and test the expression, that looked a little like this

^[\s\S\u00C0-\u024F]{1,100}$

All this proves that Oracle Policy Automation has a whole bundle of things you can achieve in Data Validation without going near JavaScript or jQuery.