Welcome to the OPA Hub!

Category Archives: Oracle Policy Automation

OPA Hub Quiz Winner

Prize Quiz Open Again – Try your Luck!

Prize Quiz Open Now – Try your Luck!

For those of you who fancy winning a nice set of prizes, the OPA Hub Website Prize Quiz has opened up again for new entrants. It’s extraordinarily humbling to see that since we introduced them, over 1,200 quizzes have been taken.

To help you get in shape for the prize quiz, we are releasing over the next few weeks another 3 short quizzes, which give you the feel of the prize quiz without the stress. And to further incite you to try your luck, we have reset the leaderboard on all the quizzes. So if you are quick you might be top of the leaderboard for a while!

To keep everyone on their toes, the prize quiz has also been updated and now has more questions, some of which are, really quite hard. But they should be fun as an intellectual exercise. Here are some of the prizes that are on offer this time. As well as copies of the JavaScript Extensions for Oracle Policy Modeling book, we have our limited edition mug with our mascot celebrating your OPA Hub Quiz victory.

OPA Hub Quiz Winner

In addition, we will be giving away a an OPA Hub Cap:

OPA Hub Quiz Cap

The results of this round of the quiz will be published on May 31st, 2020, so you have a few weeks to get ready for it.  Just to keep you on your toes, we will be adding further questions to the quiz during the competition period – so if you take it twice, you would not have the same questions in each Quiz. In the meantime of course you can also get some practice by trying our quick and easy quizzes that you will find in the menu above, under (surprise surprise) Quizzes.

It’s only left to us to wish you good luck in the competition, and to ask you if you have ideas for further quizzes, then please reach out!

Dynamic Images in Forms

Dynamic Images in Forms

I had an interesting exchange about this subject on another forum, so I thought I would reproduce it here in another slightly more structured format. The question revolves around the following requirement :

  • In an Oracle Policy Automation project, display a dynamic image – for example, a chart derived from dynamic data such as a D3.js visualisation.
  • From that dynamic chart, get a bitmap copy of the D3 chart
  • Push that image into a Form using BI Publisher.

For the sake of simplicity let’s assume that you are using Word RTF as your basis, although it should also work in PDF templates.

What is the shopping list we need for a prototype dynamic images in Forms:

  1. D3 chart content (as an SVG) can be dynamically displayed (something like the attached sample project)
  2. Get hold of the SVG from D3 and redraw it on a Canvas
  3.  Now convert the Canvas to JPG
  4. The JPG can be served up to BI Publisher using Base64 encoding

In short order, therefore:

We can get the D3 SVG and copy it onto a canvas element :

function paintSvgToCanvas() {
var pbx = document.getElementById("pbx");  //this is the image that will be displaying the SVG copied from D3
var uCanvas = document.getElementById("mycanvas"); // this is the HTML canvas
var uSvg = document.getElementById("mySVG"); // this the D3 SVG
pbx.src = 'data:image/svg+xml;base64;utf-8,' + btoa(unescape(encodeURIComponent(uSvg.outerHTML)));
uCanvas.getContext('2d').drawImage(pbx, uCanvas.width / 2 - pbx.width / 2, uCanvas.height / 2 - pbx.height / 2);

// Now we have a canvas, with the SVG on it


In the second step, we can get that SVG on our canvas and turn it into a bitmap:

var imgInitial = canvasTag.toDataURL("image/jpg");
var imgFinal = img2.replace(/^data:image\/(png|jpg);base64,/, ""); // strip off the header, not needed for BI Publisher
var finalImage = document.createElement("img");
finalimage.setAttribute("width", "800");
finalimage.setAttribute("height", "470");
finalimage.setAttribute("id", "finalimage");
finalimage.src = imgInitial ; // display the image using the full toDataURL

interview.setInputValue("myimage", imgFinal ) // push the toDataURL less the header into an attribute for BI Publisher

Finally, in BI Publisher, ensure that you use the same tag structure as the Signature feature to ensure the image is correctly handled:

<fo:instream-foreign-object content-type="image/png" xdofo:alt="An Image" ><?myimage_value?></fo:instream-foreign-object>

And it works. Of course it really should work, since the underlying mechanism is used out of the box to allow signatures to be printed in BI Publisher Forms :

But the as yet immovable issue, is that Text attributes are limited to 32,767 characters, so the dynamic images in Base64 better be simple ones, or we run out of space.  There are a couple of potential workarounds none of which is very appealing – somehow splitting the image across multiple entity instances and concatenating them in BI Publisher code (ugh). Compression is not an option since Base64 compresses so poorly, which is an interesting discussion in itself.

Have fun with some not-too-big images!

Thoughts on Installing OPA 19D On Premise

Thoughts on Installing OPA 19D On Premise

I addressed these thoughts in another forum, but figured I might put them here too, but under a different angle. Recently I discovered, as you do, that the installer for the On Premise Server Components of Oracle Intelligent Advisor 19D (aka Oracle Policy Automation Server Components) had a bit of an issue. As you probably know, it comes with three options (there used to be a fourth I think, in the 2014 timeframe, when the In Memory Analysis Server thing was being introduced).

Installing 19D

You can see them in the top part of the screenshot above, and you can see my issue in the lower section. the installer just dumped me out without any warning, complaining that I hadn’t given the deployment a name. Well I had not had a chance to even think about it because the script crashed as soon as I hit Return. Now, the java magic behind this script has been reverted to “Update 1” rather than “Update 2” according to the excellent response I got from Oracle. But that is not the purpose of this post.

In spite of the error above, and the errors in the other two options which stopped me from doing anything at all  – the second option had the same problem:

And the third option couldn’t work without the database and randomize seed key being present. So I was stuck. This was just a test machine, so I was not under life or death pressure, but I didn’t want to give up as I had to do some work on 19D. So after checking everything was versioned correctly and installed (WebLogic 12c was already running and healthy, Java JDK and JRE installed and in the path, that sort of thing) we decided to do it manually.

The On Premise installation of Oracle Policy Automation can broadly be defined as three steps

  • Create the user and database
  • Populate the database with the tables
  • Populate the tables with the seed data (such as the user admin)

These can be done manually by a combination of the following :

  1. Reading and following the On Premise guide where it provides helpful examples of the creation of the OPA Hub database user. There is little more to do that make any changes to the password or username and just run it.
  2. Running the SQL Script in the /unzippedinstaller/opa/bin/sql folder that creates the database (“create_tables_oracle.sql”). Again, aside from making sure you are connected with the user you just created, just click and go.
  3. Running the SQL Script which injects the seed data (such as the admin user and the basic roles, configuration settings and so forth) which is in the private_cloud subdirectory and is called “seed_data_oracle.sql”.
  4. The final step is to reset the admin password for the future OPA Hub. This uses the admin command (the admin.sh or admin.cmd is present in the unzipped folders in the same location as install.cmd) with the -resetpassword switch. The various options are detailed in the documentation, if you are using Oracle DB don’t forget to use both the dbconn as well as the dbtype and dbuser and dbpass options. If you get a message about admin not being a user, go into the authentication_pwd table (there should only be one record) and change the status flag from 1 to 0 or vice-versa. Commit the changes then run the admin script again with your new password request.
  5. You can now run the third option to create the web applications and manually install them on the WebLogic server using the Deployment option. Don’t forget to create a Data Source pointing to your database before you install (it is documented here). On a test server I always put it as the default datasource as well to save me time.

Now you should have an up and running OPA 19D :

19D Welcome Screen

There are of course a number of other things you might have to fiddle with or that you can leverage. In my case, there was already a 19D database instance installed some days previously using the original installer, so a clone might have been an easier option.

Now let’s just make something clear. Under no circumstances am I telling you to do this. I’m putting this here because I thought it was interesting and educational. But you must the installation tools and guide provided. I will not be held responsible for anything or anyone.

JavaScript Extensions

JavaScript Extensions for Oracle Policy Modeling

JavaScript Extensions for Oracle Policy Modeling

The JavaScript Extensions for Oracle Policy Modeling book is now available in all the channels that are currently supported:

Buy it from the Publisher

This option is probably the best if you are looking for the eBook. There is also a great bundle deal at the moment with the Getting Started with Oracle Policy Automation 2019 book. For more information you can find the details over on the P8 Tech website page.

Buy it from Amazon.com

The information that Amazon prints regarding availability of the title is incredibly vague and usually inaccurate. But at the moment, it is correct – it is shipping in a couple of days. This option is good for North American readers therefore. Find out more from the Amazon.com page here.

Buy it from Amazon.co.uk

Just like it’s global counterpart, the shipping information is usually wide of the mark but at the moment they have got it right, you can order the book from Amazon.co.uk and it will ship very fast. I’ve included a pretty picture of the book below, or you can click this JavaScript Extensions for Oracle Policy Modeling link. Full disclosure, this link is an affiliate link that earns us 50 cents extra on every purchase.

Buy JavaScript Extensions for Oracle Policy Modeling from the Book Depository

The most efficient and cost-effective way for the Rest of the World to acquire this and the other titles in the collection, the most important benefit of using this supplier is the fact that the book can be shipped anywhere in the world and they are remarkably efficient. Price-sensitive customers will find their shipment charges more attractive than Amazon in general. You can find out more from the Book Depository page for JavaScript Extensions for Oracle Policy Modeling.

What about the other book?

Some of you have been asking about Getting Started with Oracle Policy Modeling. Here are some answers:

  1. Yes it is being updated, worked started in the holiday season
  2. Yes it is being renamed because the product has been renamed and because the scope of the book is broader than ever
  3. Yes it will be released as soon as possible (probably end of Q1, early Q2)
  4. No it will not have broccoli on the cover. Tune in later to find out what it will be. Or submit your suggestion!

Input Extensions – Input Validation

Input Extensions – Input Validation

Following on from the recent posts about Errors and Input Extensions, this week we’re going to look at input validation and error handling. Not, you will understand, error handling in the JavaScript sense (writing try…catch and so forth) but how to handle errors that the user makes when entering data in your Input Extension.

Let’s set the scene with some simple examples. You have created an Input Extension in the form of an INPUT tag that displays an attribute for the user to enter. You intend to use the validate handler to do the work of testing the user’s data entry and flagging it to the user if they have made a mistake.

So you begin by understanding that the validation handler is ultimately a three way trigger : you can return true (in which case there is no error, and the data entered passes validation) or false (you wish to signal to the user there is an error, without an error message) or better still  a text string which means yes there is an error, and furthermore here is a text string to tell you what it is. For our little example, we will therefore be looking to handle true  and text string.

Basic Validation

var currentValue = document.getElementById("xInput").value;
var bBanana = document.getElementById("xInput").value === 'BANANA';

In the above example, we retrieve the current value of the INPUT and compare it to the text string “BANANA”. If you have entered “BANANA” then you have passed our validation (true) and if not (false).

return "JavaScript Validation Error";

Great. The case is solved, to paraphrase a famous detective. But then, one day, your Input Extension stops working. It mysteriously refuses to validate your user’s data entry, even when the data entry is correct. It simply refuses to let the user go forward, but there is no error message. So where is the problem coming from?

You take a look at the attribute you are supposed to be validating and notice that the rule designer has added something since you last looked:

Input Validation 1

So the rule designer has added a Regular Expression to the attribute. And what you are entering, perhaps, is not matching the RegEx. But how on earth are you supposed to check for that / handle that in an Input Extension? There is no documented process / property set for this, but if you dig down deep enough, you can find the following properties:

Input Validation – RegEx

control._source.config.inputRestriction.regularExpression (the RegEx)

control._source.config.inputRestriction.rawErrorMessage (the message)

The above properties give you access to the rule designer’s RegEx and associated error message. They do NOT, however, test the value of your input against the RegEx. So don’t forget to actually include the RegEx in your validate handler. At a simple level it might be something like this:

var regExpression = new RegExp(control._source.config.inputRestriction.regularExpression); 
var bTestInput = regExpression.test(currentValue);

Again, we will have a boolean variable which will tell us if the text entered has passed the RegEx validation or not. So now you can include this in your standard validation, to be able to present the user with reasonably decent message:

Input Validation - 3

OPA Hub Website Supporters can download an example project from the OPA Hub Shop. You’ll find the official reference online.

And the Training Survey Prize Draw Winner Is…

And the Training Survey Prize Draw Winner Is…

So, the results of our Training Survey Snap Poll have been collated, and we are ready to announce the winner in just a moment. First, let’s get the results off our chests and see what the community thinks about Oracle Intelligent Advisor (see what we did there?) and Training Requirements. So the OPA Hub Training & Documentation Survey started with the following question:

Q1: Which of the following training products would you consider the most suitable training format for OPA?


Training Survey 1

Interested in the Training Survey data breakdown? OPA Hub Website supporters can download the PDF here. You can get a quick glimpse of the latest results on this public dashboard.

The two “in class” options beat the other answers hands-down. Consultants and users, in contrast (often) to their employers, still regard in class training as the premium format. Then comes interactive online training, finally we have recorded / non-interactive online training. Managers, Training Departments, take note! We’ve been in the training business for 30 years, and the answers were the same 30 years ago (albeit with CD-ROM or computer based training instead of on-line). At some point, the value for money equation became focused on the cost rather than the benefit. And it all went wrong from there :).

Training Survey Q2: Which of the following have you personally used most recently in relation to Policy Automation?


Training Survey 2

And so we come to the reality on the ground. If question one represented what you wanted, this is what you got! Very low numbers for in class training, and much higher for online. The Other option revealed that a fair number of you don’t even get that option, instead you have to read the documentation, forums, websites like this one, or just asking colleagues. What does that say about the availability and cost of training in your area, or the unwillingness of employers to pay for training? Some might blame the Salesforce Effect “Trailhead means I don’t have to buy any training for my staff ever again”. Yeah, right.

Training Survey Q6: In which region are you based?

S0 does Oracle Policy Automation only exist in your area?

Training Survey 4

These are only 3 of the Training Survey questions – we don’t want to bore you with all this unless you are interested in the full data breakdown? OPA Hub Website supporters can download the data here. You can get a quick glimpse of the latest results on this public dashboard.

So who the heck is the winner?

The OPA Hub Website is pleased to announce three winners (yes, we came over all “Holiday Season”).

Mr O.Rodrigues (France)

Mr Manohar Veeraiah (India)

Miss A.Fisher (Australia)

The winners should leave their details in a message using the Contact Form of this website.

Errors – Show Immediately and On Navigate

Errors – Show Immediately and On Navigate

I often come across issues with Errors in Oracle Policy Automation interviews. When working with errors, it’s useful to know the sequence and processing order of the different types. Furthermore, you need to have a good handle on errors when working with Input Extensions. Let’s take a quick look first of all at a simple, out of the box scenario involving two attributes (the First Name and the Second Name). The First Name has a Regular Expression and the Second Name is targeted in an error Rule:

First Name

Errors - Show Immediately and On NavigateSecond Name

Errors - Show Immediately and On Navigate 2

Show Immediately

Let’s imagine that these two are both on the same Screen, and that Screen is set to “Immediate Errors” :

Then Error Rules (with Error()) will fire and display the error before the Input Validation message is displayed. So when you start the interview you will see the Error() rule message display at the top of the Screen, and a red triangle on the other attribute because it is mandatory:

Errors - Show Immediately and On  Navigate 3

If the First Name attribute is not mandatory then you will still see the triangle because of the RegEx error, but you will not see the red error banner displaying the Error text. Instead it will be in the tooltip. The second name will get the same treatment, as the mandatory check produces an error immediately.


It’s only when you click the Next button, that you get the full display of all the messages:

And that can be quite confusing for the Interview designer.

On Navigate

It changes, furthermore, when you switch the Screen to On Navigate for Error handling. When arriving on the Screen, the error display will show nothing, until you put your mouse into the First Name – then you will see the mandatory icon:

Let’s assume you enter a value in the First Name, but ignore the Second Name. You click the Next button:

You get the RegEx Input Validation error, and the mandatory error. But the Error() rule in this case does not fire, since the mandatory error is blocking it from executing so to speak  – an error has occurred before the Error() rule gets a chance to fire.

Now, enter a valid value in First Name, and an invalid value in the Second Name, and you get this:


The Error() rule has had a chance to execute as the mandatory flag has been resolved – you entered something into the Second Name, even if it was not valid according to the Error() rule.

This sort of sequencing and display logic is important when designing Interviews, especially when combining Error and Warning rules with attribute-level input validations. There’s more about Input Validation in the Help of course.

In the next post in this series, we will look at Error handling in Input Extensions.

Input Extensions – DropDowns

Input Extensions – DropDowns

Many thanks to long-time reader and Oracle Policy Automation expert Aaron H for an interesting discussion just before the holiday season. The subject for this post is as you can tell, Input extensions that are dropdowns.

Our conversation was wide ranging but this article will focus on a couple of things

  1. How to ensure that the extension displays and handles the text and value elements of your list of values
  2. How to handle <uncertain>
  3. How to have a different label for <uncertain>

Along the way this will give us the opportunity to understand the usefulness of the Value() function in a rule. In later posts in this series we will look at other forms of Input, also beyond the basic INPUT or SELECT tag.

So let’s begin with a simple setup – the Zip Archive is available in the OPA Hub Shop by the way) – starting with just one attribute and a Value List:

The initial Value List looks like this – notice that in this case, there is no distinction between the displayed text and the actual value:

Input Extensions - DropDowns

In this simple scenario, one often sees extension code that focuses on the control.getOptions() method and then iterating through the various options from the returned object, something a little like this (for educational purposes only) :

var myChoices = control.getOptions();
for (key in myChoices) {
$('#xDropDown').append('<option value="' + myChoices[key]..text.toString() + '">' + myChoices[key].text.toString() + '</option>');

The code works fine, but makes a few assumptions that can come back and bite later when the rule designer has made changes.

  1. It does not take into account the possible change in the Value List to include display and values.
  2. It will error out if the dropdown becomes non-mandatory since “uncertain” will cause .toString() to fail

So when the developer of the rule changes the Value List to something like this:

Input Extensions - DropDowns 2

The code would no longer be useful since the [key].text and [key].value are two different values. And if we are updating the underlying control, we need to remember that we call control.setValue() so it is expecting a value, not the display value.

So maybe the code gets changed to :

 $('#xDropDown').append('<option value="' + myChoices[key].value + '">' + myChoices[key].text.toString() + '</option>');

Or something similar. All is well and the dropdown is correctly handling things :

Until the attribute is defined as non-mandatory in the Screen where it is displayed. At which point the code breaks again, as the uncertain value is not handled. Let’s take a step back and remind ourselves of the defaut behaviour in these situations, without an extension:

The standard control renders an empty option for the uncertain value. I’ve always considered it a bit of a bug that it does not respect the optional Display Value (in my case, “Not Sure” – see the screenshot a little further up) but always renders a blank, at least in all my browsers.

So in the case of an Input Extension that needs to render the uncertain value (because the control is not mandatory) and also wants to show the Display Value, the code will probably need to have another quick change:

Input Extensions DropDown Code Last One

Which will ensure that the dropdown is rendered with the correct text and value, if there is one. Also, the added bonus is that the display text of uncertain is rendered as we would expect:

Input Extension Showing Uncertain Vlaue

And finally, we have good use of the Value() function so that we can be sure that the correct value is stored in our Interview:

The function above, in a Word document for example, will return the value rather than the display value. So you can drop it onto the final Screen of your testing Project and compare the two to make sure you have gathered the correct one.

Hopefully that was fun and interesting, and you can practice yourself with your own project. As mentioned above the code is available in the OPA Hub Shop. The documentation is of course on the Oracle Intelligent Advisor website.

JavaScript Extensions

Just in time for the Holidays – JavaScript Extensions for Oracle Policy Modeling

Just in time for the Holidays – JavaScript Extensions for Oracle Policy Modeling

Oracle Policy Automation Interviews allow users – customers, citizens, employees – to work quickly and easily with the powerful natural language rules and policies defined in Oracle Policy Modeling through an interactive website that guides them with intelligent advice. Customers around the world rely on Oracle Policy Automation Interviews to help people calculate benefit entitlements, decide what university courses to take, return an unwanted item to the store, find ways to eat more healthily, and more. OPA drives literally thousands of business-critical processes. Introduced in 2017, JavaScript Extensions allow Interview designers to completely reconfigure the end-user experience, and this book, JavaScript Extensions for Oracle Policy Modeling, shows you – the OPA developer – how to enhance and streamline user experiences by adding customizations like:

  • Label Extensions
  • Input Extensions
  • Search Extensions
  • Options Extensions

All of these allow for the design and creation of modern, corporate-themed interactions that leverage standard HTML5 and JavaScript within the framework of Oracle Policy Automation.

This practical and fully up-to-date book also covers the advanced uses of JavaScript Extensions, including:

  • Entity Collect Extensions
  • Entity Container Extensions
  • Relationship Extensions
  • Button and Event Extensions

JavaScript Extensions for Oracle Policy Modeling is aimed at Interview designers, and Richard Napier explains and demonstrates the features of the JavaScript framework with 50 examples. These are available for download for study and further customization. This book, thanks to the author’s well-known informal style and business-driven approach, will enable both technical and non-technical readers to make rapid progress in their understanding of the JavaScript Framework.

Now Available – Great Bundle Deal

This book – in paperback form – is coming onstream with retailers (ignore Amazon.co.uk’s 1-2 months; it’s a default message and incorrect). If you would like to get your hands on a copy, now, the PDF is already live on the links below (and we have a GREAT bundle deal too – please see below.)


Oracle Intelligent Advisor

Oracle Intelligent Advisor

As many of you will know, the official announcement was posted early last week – Oracle Policy Automation will henceforth be known by another name – Oracle Intelligent Advisor. At first glance, the name does not perhaps jump out at us the way Oracle Policy Automation did. But after a few minutes reflection, I think it becomes clear that this is a much more appropriate name. Why?

  1. Policy was always a difficult word to describe and define. Firstly because it does, to many people, and in many languages, speak of policy in the public sector sense. Of course, business policy was intended as a target also but it didn’t perhaps resonate with that audience. The new name speaks to a wider population and many more potential customers.
  2. The product that was Oracle Policy Automation has, in the last few years, increased massively in depth and breadth. From a largely file-based development system and rustic WebLogic deployment process  to a fully version-controlled, permission-based Hub in just a couple of years and that was only the start:
  3. The arrival of omnichannel into the Intelligent Advisor universe certainly changed the game – whether you need to call the determination engine via REST, SOAP, as an app or custom development using Mobile, or with a Chat engine like Oracle Digital Assistant, through traditional HTML Interviews, we’ve got the situation covered.
  4. More recently, and this for me is the biggest leap forward, we have seen enormous progress in the integration domain. With the ability to integrate Oracle Intelligent Advisor into Oracle Integration Cloud Service, and more broadly to let any REST-based integration platform integrate the platform  into business flows, as well as the SOAP-based Connection framework that already existed, we can now knit our work ever more simply into the wider enterprise.
  5. All off these things, and the myriad of enhancements that have seen the light of day in 2019, make me very excited and enthusiastic for the future of this product family as it reaches out to the customer, whoever they are and whatever industry or scenario they are in, to provide agile, personalised transparent decisions.
  6. To serve this ever-broader community and to reflect the new naming, this website will be publishing an updated “Getting Started with Oracle Intelligent Advisor” early in the new year.

In 2020, we can look forward to many more leaps forward as Oracle Intelligent Advisor takes the stage. If you want to find out more about it, then of course use the Oracle Blog, Oracle Forum and Product Page and stay right here on this website! Watch out for our own rebrand of this website in the coming year.

Oracle Intelligent Advisor