Comments are lines you write in a rule, which the system will ignore.
They have no impact on how a condition is evaluated, how a value is assigned, what the next step in the process should be, etcetera.
Adding comments to rules is a way to:
Explain why a rule exists.
Explain a particularly complicated part of a rule.
‘Comment-out’ part of a rule, meaning the system will ignore it.
You turn a line into a comment by putting a hashtag
# at the start of it.
# According to regulation, only people living in Switzerland# need to fill out this document.p is Personp.domicile = CHE
atfinity completely ignores the first two lines that start with # and only acts on the last two lines.
The first two are a comment, explaining to other rule designers why the rule exists.
In this example, the reason for the rule is pretty self-explanatory and not really in need of a comment. However, with more surprising rules, this type of comment can be very helpful.
p is Person# The sum of percentages from all sources of wealth needs to be exactly 100.SUM((if allowance in p.sources_of_wealth then p.percentage_allowance else 0 end),(if inheritance in p.sources_of_wealth then p.percentage_inheritance else 0 end),(if lotteries in p.sources_of_wealth then p.percentage_lotteries else 0 end),) != 100
You want to know all sources of a person’s wealth. There cannot be an unaccounted for 5 percent. That means the percentage values of the various sources have to add up to exactly 100.
The rule in the example above ensures that an issue will be raised if the sum of all percentages is anything else than 100. Because the SUM part of the rule is a bit complicated, we added a comment line, explaining our reasoning.
p is Person# p.domicile = CHE
In this example,
p.domicile = CHE is preceded by a
#, meaning it is commented-out and therefore ignored by the rule engine. While we are designing our processes and rules, this can be a powerful tool to figure out why a rule is or is not executed.