Build 354: Control Statements in Postludes


Kynetx Logo

This afternoon we releases Build 354 of KNS supporting the addition of a last control statement to postludes. In addition, we also now allow guard conditionals on any statement in a postlude. These are relatively minor additions to KRL in anticipation of some larger features that are coming soon.

The use a last statement in a postlude will halt the execution of the ruleset at that rule if it is executed. So, the following statement would halt execution after the current rule if the rule fired:

fired {
  last
}

This can be useful for rules that initiate action that must be completed before any of the remaining rules in the ruleset are meaningful (like authorization...hint, hint). That saves you from having to guard all of the remaining rules with a premise checking that the action has been completed.

As an example of using a guard condition on a postlude statement, consider this example:

notfired {
  ent:page_count += 2 from 1 if(not_available eq "yes")
}

This would only be applicable if the rule didn't fire and in that case only increment the page_count entity variable if the value of the variable not_available was "yes".