Access the values in a Decision table column expression using API
How can the values in a Decision table be accessed using API?
You can navigate through Decision Table values and expressions through API. The Decision Table structure is modeled by the class ilog.rules.dt.model.IlrDTModel.
Start by retrieving the model from your Decision Table artifact in Rule Studio:
Decision Table Conditions:
Suppose you want to retrieve the date input in the cell of the condition column of a Decision Table.
- Start by navigating through the condition columns and the cells of the columns.
The condition columns of a decision table are represented by IlrDTPartitionDefinition, and the condition cells are represented by IlrDTPartitionItem.
To navigate through the conditions/partitions, use the following:
IlrDTPartitionItem rootItem = rootPartition.getPartitionItem(0);
rootItem will refer to the first condition cell of the Decision Table.
- Get the expression of the condition cell:
If the expression is an IlrDTExpressionSentence, the cell may be split according to its number of parameters. The contents of the cell/subcells represent the value of the parameter(s) of the expression.
The IlrDTExpressionSentence represents the sentence of the condition, for example, "the age of a customer is between 18 and 25".
The expression is split in different parts:
the holder role expression: the age of the customer
the sentence context: <a number> is between <a number> and <a number>
the parameters roles: 18 and 25.
- Retrieve the parameter role from the expression:
- Call the method getValue() on IlrDTExpressionRole to get, for example, the value of the date in the condition column.
Decision Table Actions:
Suppose you want to retrieve the value input in the cell of the action column of a Decision Table.
The action columns are represented byIlrDTActionDefinition, and the action cells are represented by IlrDTAction.
- Retrieve a set of actions corresponding to a particular partition item (condition row) of the DT:
- Get the required action from the action set:
- Retrieve the expression for the action:
- Retrieve the values you require by navigating through the expression sentence of the action, as you did for the expression sentence of the condition.
More support for:
WebSphere ILOG JRules
Software version: 6.7
Operating system(s): AIX, HP-UX, IBM i, Linux, Solaris, Windows, z/OS
Reference #: 1424955
Modified date: 14 February 2011