Example: Display a Screen     

When investigating a goal, calling Attribute.getNextQuestion() returns a single attribute whose value is required next. However, when screens are defined in the rulebase, it is usually preferable to find a screen that collects the particular attribute and display that screen instead of the single attribute. This allows related questions to be grouped together on the same screen, and allows the appearance of the query to be specified from within Oracle Policy Modeling. For example, an attribute's value might represent a user's country of birth, and should be restricted to a specific set of values. The information about which values are acceptable is defined on a control inside a screen.

This example is an extension of the example of investigating a goal. Instead of directly asking the next question to the user, it retrieves a screen for the next question, and asks for an answer for each of the attributes that appears on the screen. In a real application the screen would probably be displayed as a window, or as a form on an HTML page, but for simplicity, this example just displays the text of each control on the screen and asks for answers if the control collects data.

Click on the appropriate link to view either the Java or the C# example:

 

Java Code Example:

C# Code Example:

 

See also:

Investigate a Goal