In NPDRules, see the _DefineDTblConditions( ) method in the Examples class. Notice that the argument of this method (an array of pointers to ConditionData) is an input to the InitRuleData( ) method in the Sample__DTbl_Definer class. In this method, instances of the ConditionData class are constructed, each of which represents a Condition of a decision table. Pointers to these instances are saved in an array, which serves as the method's output argument.
The first step is to dimension, or redimension, the array so that it will hold the pointers to Conditions that you want in the decision table.
Array.Redimension(ConditionArray, 2) // Two Conditions
A Condition of a dynamic decision table must always reference a domain interface member. A domain interface member is represented by an instance of the class DIMember in DynRLib. The next step in building a definition for a non-persistent dynamic decision table is to create an instance of the DIMember class that defines the domain interface member you want to reference in your condition. Simply specifying a label for the domain interface member can do this. (Of course, this must be a valid domain interface member defined in the application or one of its imported libraries.)
var pDI is &DIMember pDI = DIMember.Create(NULL, "Person Age?", NULL)
The ConditionData instance that defines a Condition in a non-persistent decision table must:
For example:
var iEle is integer = 0 iEle = iEle +1 ConditionArray(iEle) = ConditionData.Create( )
// Create a ConditionData data instance and set an // array element to point to that instance.
ConditionArray(iEle).SetMember(pDI)
// Point this ConditionData instance to the Person // Age? Domain interface member
var TestValues is string TestValues = ">=21..<=150" &CHAR_TAB & "unknown"
// Specify the test values for this Condition just as // they would be specified in the decision table // editor. Values must be separated by a CHAR_TAB
ConditionArray(iEle).SetTestValues(TestValues)
Note: For more information about constructing Condition test values, see Condition Test-Value String Format.
Important! An instance binding may be required for a Condition. This binding may be set during the Condition construction phase (see the example in NPDRules) or be passed as an input argument in the posting method (see Posting a Non-Persistent Decision Table). For more information about instance binding, see Dynamic Rule Runtime Considerations.
The preceding procedure is repeated for each Condition in the decision table.
| Copyright © 2009 CA. All rights reserved. | Send E-mail to CA about this topic |