[rules-users] trouble adding newline to DSL

Edson Tirelli tirelli at post.com
Mon Jun 16 11:51:05 EDT 2008


   Hi Matt,

   If I remember correctly, you need to use \\n to break lines. Also, I
think this should work:

rd: RuleData(offerId == "{offer}", uc : userContext)  not ( Account(where
{constraints}) from uc.accounts)

    If it is not working, maybe you can open a jira for it? Meanwhile, as a
work around try adding an "and" there:

rd: RuleData(offerId == "{offer}", uc : userContext)  and not (
Account(where {constraints}) from uc.accounts)

    AND is supposed to be implicit, but making it explicit should create no
problems.

    []s
    Edson

2008/6/12 Matt Geis <mgeis at yahoo.com>:

> 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
>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080616/80ddd8b4/attachment.html 


More information about the rules-users mailing list