Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-2252

"Unable to expand" error with acculumate in Guided Rule Editor with DSL

XMLWordPrintable

    • 2018 Week 03-04
    • Hide

      See Description

      Show
      See Description
    • NEW
    • NEW

      In Guided Rule Editor with DSL option, you can add "From Accumulate" but "Function"/"Custom Code" gets an error "Unable to expand".

      Reproduce steps:

      • Unzip the attached reproducer-repo.zip
      • Clone the repo via business-central "Administration" > "Repositories" > "Clone Repository"
      • Go to Project Explorer, choose the repo, choose "project1"
      • Go to package org > kie > example > project1. You will find DataObject 'Person,' DSL, Test Scenario
      • Create a new Guided Rule. Check "Use Domain Specific Language (DSL)" option
      • Add conditions (See guidedrule01.png)
        • DSL "There is a person whose age is 20"
        • "From Accumulate ..."
          • Choose "Number" for the first "click to add pattern..."
          • Choose "Person" for the second "click to add pattern..."
          • Configure Variable name "$p" for "All Person with"
        • Write "count($p)" in Function
      • Save
      • Press "Validate"
      • You will get an error "Unable to expand" (See error01.png)

      This is because "count($p)" line doesn't have preceding ">".

      rule "gr1"
              dialect "mvel"
              when
                      There is a person whose age is 20
                      >Number( ) from accumulate ( $p : Person( ),
                              count($p))
              then
      end
      
      • If you add ">" at the begging of Function (See guidedrule02.png), you don't get the error.
      • But if you close the Editor and reopen the rdslr, the condition is rendered as free form DRL (See guidedrule03.png). So it cannot be a workaround.
      • "Custom Code" has the same problem as "Function". Furthermore, "Custom Code" cannot use ">" because ">" wouldn't be placed at the beginning of the line.

              manstis@redhat.com Michael Anstis
              manstis@redhat.com Michael Anstis
              Jozef Marko Jozef Marko (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: