We’re back with another in our series about Relationships in Oracle Intelligent Advisor (the previous part can be found here, with links to the others). Amazing to think that this is part eight covering Reverse Relationships, and that we’ve been going for over a month. Relationships are – judging by the number of posts on the Oracle Intelligent Advisor Forum – challenging for newcomers and therefore we are happy to note that this series of articles is already one of our most popular.
Let’s get into the subject today, a very easy one to start 2022. Reverse Relationships (or inverse relationships as they are sometimes called). We can begin by explaining how to set one up. It couldn’t be much easier:
So if you can set up a reverse relationship like that, what might you use it for? What purpose does it serve? What can I do with it? What are the potential challenges? That’s right, there are lots of reasons to use this feature (and in fact you can say that this “feature” actually exists everywhere on all relationships, it’s just that the act of adding text means you can use it in your rules and interviews) and there are also some “twists” that can make it confusing.
As always we need an example to help. Here is our scenario: we have an entity model that has customers and products. We’re using the project that has been used in many different chapters of this series. Let’s imagine that we want to track which customers use our own-brand products. So we create a relationship between them, and make it Many To Many since a customer can appreciate many products, and a product can be appreciated by many customers.
And as you can see above, we have filled in the reverse relationship section as well. This is important if you intend to use the reverse relationship in rules in Word or Excel. You need some way of addressing the relationship.
Now let’s look at one area that confuses. We add the relationship to a Screen. And when you do so, you can only ever collect (or infer) the relationship in what is known as its primary direction. So there is no mention of the customers who chose the products in the dropdown.
But if the reverse relationship becomes known, you certainly can use it.
In the examples above, the reverse relationship text is used to find the number of products chosen by the customer and to find out if the customer purchased supermarket own-brand beans. Bear in mind a couple of things though – firstly, as a positive by-product of your work, you now can use the “Go to reverse relationship” option in the Debugger with confidence – you’ll know what they mean:
Secondly, the work you are doing may potentially give you a slight headache if you ever reach a point where (to use our example) you have data for two out of three customers. The third customer, let’s say the choices are unknown. We don’t know which products the customer chose. So, the reverse is that we cannot display the result of our count that uses the reverse relationship:
This doesn’t usually happen in an interview, since showing the relationship on the screen and getting no responses will be tracked as all of the answers being “no”, but can happen in Web Service projects where you have unknown results popping up because the data is only partially known.
Let’s finish this with a quick walk-through video to wrap it all up. The official documentation mentions Reverse Relationships.