[rules-users] Rule Templates - Conditionally Generate Rule based on Values in Data

Jason Allen jason.allen at data-sign.com
Tue Jun 18 10:58:45 EDT 2013


All,

I saw this question was asked a couple of months ago with no reply, but thought I would try again.

In using a Rule Template, I'm trying to determine a way to dynamically generate rules based on a value in the data.

There is a data set, that has various pieces data, depending on a column value, the rule that is generated is relatively different.  Different enough that I wouldn't want the generated a rule for each row of data, because many of the rules generated would never fire.

In the drools expert docs, it lists under 6.1.7 Rule Templates the ability to "conditionally generate rules based on the values in the data", but I can't seem to find the syntax for how to do that.

Does anyone know the answer to this?

I would picture it looking something like this

if ("@{RevenueCode}" == "NR")
rule "RevenueMapperRule_1"
when
	claim1 : ClaimFact (ProgramType in ("FC", "FCP", "FALSE", "FALSE"),
					ProcedureCode == "NR",
					(serviceBegin >= "01-Oct-2003" && serviceBegin <= "31-Dec-2030"),
					modifier1 in ("U"),
					typeofBill == "3");
then
	claim1.setResultSPCCode("507.11");
	list.add(claim1);
end
end if

Essentially, the only time this rule would be generated is if RevenueCode in the Rules Spreadsheet had a value of "NR".

If this is not possible, how should I be thinking about this problem?  Feels weird to generate a bunch of rules that will never fire, simply because there is no way to conditionally generate a rule.  Maybe the answer is to create separate rule files and template definitions?  That also feels like an over complication.

Thoughts?

Thanks in advance!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130618/a2fdb4dc/attachment.html 


More information about the rules-users mailing list