Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 126605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:20:39+00:00 2026-05-11T05:20:39+00:00

I’m using Drools (for the first time) to express some rules and it has

  • 0

I’m using Drools (for the first time) to express some rules and it has been working really well so far. However I’ve been given a new condition that I’m not able to express in the rules language very clearly.

Essentially I need to perform an action on the players account if they have an outstanding balance on there account between a certain amount, where they haven’t made a payment in the last week and where they haven’t made a payment in the last 4 weeks that is greater than or equal to a weekly deduction. There are a few other rules but I’ve removed them in an effort to simplify the rule for this question. It’s the last rule that is causing me a problem.

rule 'The broken rule'    salience 10    no-loop    when       Player( $playerNumber : playerNumber )       $a : Account( // balance between £5 and £100 and no arrangement        playerNumber == $playerNumber &&          accountBalanceInPence >= 500 &&          accountBalanceInPence <= 10000       )       not ( // no payment in last week          exists AccountTransaction(             playerNumber == $playerNumber &&             transactionDate >= oneWeekAgo &&             transactionCode == 'P' // payment          )       )       /* It's this next bit that is broken */       not ( // no payment > (weekly cost * 4) paid within last 4 weeks          $deduction : AccountTransaction( // a recent transaction             playerNumber == $playerNumber &&             transactionDate >= fourWeeksAgo &&             transactionCode == 'D' // deduction          )          exists AccountTransaction( // the payment             playerNumber == $playerNumber &&             transactionDate >= fourWeeksAgo &&             transactionCode == 'P' // payment             amountInPence >= ($deduction->amountInPence * 4)          )    )    then       // do some action to the account end 

The problem is that it just doesn’t work, I keep getting org.drools.rule.InvalidRulePackage exceptions thrown. I was just guessing on the syntax but couldn’t seem to find an example that showed what I’m trying to do. Is it even possible?


The full original error message is:

'unknown:50:3 mismatched token: [@255,1690:1695='exists',<39>,50:3]; expecting type RIGHT_PAREN[54,4]: unknown:54:4 mismatched token: [@284,1840:1852='amountInPence',<7>,54:4]; expecting type RIGHT_PAREN[54,22]: unknown:54:22 Unexpected token '$payment'' 

After trying the suggestion in the first comment the error is:

'[50,3]: unknown:50:3 mismatched token: [@255,1690:1695='exists',<39>,50:3]; expecting type RIGHT_PAREN[54,4]: unknown:54:4 mismatched token: [@284,1840:1852='amountInPence',<7>,54:4]; expecting type RIGHT_PAREN[54,45]: unknown:54:45 mismatched token: [@293,1881:1881='*',<71>,54:45]; expecting type LEFT_PAREN[55,3]: unknown:55:3 mismatched token: [@298,1890:1890=')',<12>,55:3]; expecting type THEN' 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:20:40+00:00Added an answer on May 11, 2026 at 5:20 am

    yes as you guessed, you need to put an explicit ‘and’ inside the ‘not’ pattern to join them together.

    The only time you don’t need the ‘and’ is at the top level:

    eg

    when Foo() Bar() 

    Doesn’t require a an ‘and’

    but this is implicitly the same as

    when Foo() and Bar() 

    So your solution seems correct. The lack of a top level ‘and’ seems to be convention in most rule languages (going back to CLIPS !)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 111k
  • Answers 111k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I think you're looking for icedtea6-plugin. May 11, 2026 at 9:41 pm
  • Editorial Team
    Editorial Team added an answer The problem will be that open will only return a… May 11, 2026 at 9:41 pm
  • Editorial Team
    Editorial Team added an answer Use the set as you proposed, that's exactly the right… May 11, 2026 at 9:41 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.