RuleSet

  • Updated

Instance of an authored Independent Rule Set.

getName() Returns: string

Description:

Returns a string of the Rule Set's name

Code Sample:

var session = inrule.createRuleSession();
var ruleSet = session.createIndependentRuleSet("RuleSet1");
var ruleSetName = ruleSet.getName(); // ruleSetName is "RuleSet1";

 

execute(arguments, callback) Returns: void

Parameters:

arguments

Type: Array of object

An Array of values to pass to the RuleSet. The values are bound to the arguments by ordinal positioning. If an argument is Entity, the value passed to it will be used as the Entity's bound value. If the RuleSet does not have parameters, pass an empty array.

 

callback

Type: function(log)

A JavaScript function accepting a RuleExecutionLog object as its parameter

Description:

Executes the Rule Set with the specified name on the Entity. If arguments are provided they are passed to the Rule Set.

Code Sample:

var session = inrule.createRuleSession();
var ruleSet = session.createIndependentRuleSet("RuleSet1"); 
ruleSet.execute([1, "value"], function(log){ // Code that checks the Execution Log });

 

getParameterValue(name) Returns: void

Parameters:

name

Type: string

The name of the parameter to get the value of

Description:

Returns a RuleSet parameter's value for the specified name

Code Sample:

var session = inrule.createRuleSession();
var ruleSet = session.createIndependentRuleSet("RuleSet1"); 
ruleSet.execute([1, "value"], function(log){ console.log(ruleSet.getParameterValue("Value1"); });

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.