[rules-users] trouble adding newline to DSL

Matt Geis mgeis at yahoo.com
Thu Jun 12 20:41:22 EDT 2008


Hi,
I'm having a really strange scenario.  I have a DSL entry that I need to expand onto two lines. When I write it as plain DRL, on a single line, the rule fails.  When I separate it into two lines, it passes.  The problem is that I'm having issues getting my DSL to insert a newline char into the drl it generates and split my resulting rule into two constraints.

Here's what I want to do... (assume the '\n actually works)

[condition][]offer with code "{offer}" and no accounts present where {constraints}=rd: RuleData(offerId == "{offer}", uc : userContext) \n not ( Account(where {constraints}) from uc.accounts)

if you put the value into a DRL rule like this, it works: 
rd: RuleData(offerId == "{offer}", uc : userContext)
not ( Account(where {constraints}) from uc.accounts)


put it in like this... it fails
rd: RuleData(offerId == "{offer}", uc : userContext)  not ( Account(where {constraints}) from uc.accounts)


I know that in a regex, the backslash is special, just as it is in replacement strings in Matcher.replaceAll().  What I can't figure out is how to split that line.  I've tried 1, 2, 3, 4... up to 8 backslashes, and nothing works.  I either get an assertion failed at the end of my test, or I get "unrecognized token" on the \ or the n .

Can someone point me in the right direction?  Or, just tell me how to make the rule work all one one line!

Thanks in advance,
Matt



      



More information about the rules-users mailing list