Let’s get started. In a simple Oracle Policy Automation Project I have three attributes : the Country, the Town and the Town Level. In each Country, there are a certain number of Towns. These can be considered as a dynamic list for the purposes of our demonstration. They will be stored in an Array of Objects. They could, naturally, be obtained from a REST call to some service or other, much like the example of Search Extension. For our purposes we will have only four towns per country. Each town has a level, which corresponds to its population size.
How can we achieve this goal: here is the example in more detail.
The User Interface is prepared according to the following screenshots:
The second Screen displays the future dynamic Options. Note how it is a simple Textbox.
In the above image, the basic setup is performed. Values of the Country and Town Level are acquired. An empty Array of towns is created.
The second part of the code is too long to reproduce here, but the above image will give you the idea. According to the Country, the array of Town objects is built. Note the text and value properties which are required, and I have added a level property. I have also, of course, created an alternative set of towns for Ireland (but I won’t show it to save space). Now I will filter the array based on the town level chosen:
In this final screenshot, you can see the filter is based on the level and the filtered array is passed out. In addition I have specified the display as radio buttons.
Executing the code in the Project we can see the following when we select the country as Ireland, and the town level as 2, for example:
In the same vein, when France is chosen, and town level 1, this is the result: