Forum Discussion
FICO
14 years agoCommunity Manager
Create one rule per element from a list provider?
Create one rule per element from a list provider? Hi I have a template: *Value holder VH-A for custom database list provider A, which lets the user select a value *Value holder VH-B for custom da...
FICO
14 years agoCommunity Manager
I am doing this from memory, so I may miss a piece so bear with me. Since you have a Value Holder that essentially holds exaclty the items you want to evaluate, the idea is to build a function template and let it use the value holder you have. So, create a function template inside the ruleset template you already have (we'll get to the content in a moment). In the ruleset create a value holder that references the function template with a count of "Exactly 1". This means that each time the ruleset gets instantiated it will also create one of these functions. If you want a different function for each "rule", then move the value holder to the rule. One thing to keep in mind is that the name of the function (not the template, the function it generates) is going to have to use some other value holders to make the name unique which ever way you do it.
Next, in the function template, set the function name (at least in part using a value holder from the rule or ruleset to make it unique), the return type and any parameters. In the function body, use the little yellow circular arrow to insert a "template loop". When the dialog comes up, select VH-B as the value holder to "loop" on (the one with the "No Selection". Inside of the loop, put your if statements with a value holder that you created the loop with. For each iteration of the loop across all of the items in the value holder array it will create an "if" statement (or whatever you coded inside the loop).
Have fun.
Tom Sheckells
Business Rules Consulting, Inc.