List Info

Thread: RE: Call a function from a function?




RE: Call a function from a function?
country flaguser name
Austria
2008-05-19 12:19:29

Hello Shahad!

 

Now, i216;ve a solution for my problem and it looks like a Bug. First, the order of the functions isn’t important, but I think it’s a very strange problem with the name of my functions.

 

Here my concrete values:

 

  rule

    when

    then

      checkHierachyInstance(...)

  end

 

  function void checkHierachyInstance(...)

  {

    checkHierachyInstanceRecursive(...);

  }

 

  function void checkHierachyInstanceRecursive(...)

  {

  }

 

As far as i have found out, the error occurs ONLY if I append anything to the functionname “checkHierachyInstanceR21;, in my case the word “Recursive̶1;. It works if I use a completely different name instead of “checkHierachyInstanceRecursive”; or exchange a character in “checkHierachyInstanceRecursive”;. For example i can use “function void myFunc(...)” or “function void checkHierachyInstancRecursive(...)”.

 

The only combination of function names i’m not allowed to use is checkHierachyInstance and checkHierachyInstanceXXXXX

 

I’ve never seen such a curiosity before.

Best regards, michael

 

 

 

From: rules-users-bounceslists.jboss.org [mailto:rules-users-bounceslists.jboss.org] On Behalf Of Michael Katai
Sent: Monday, May 19, 2008 6:00 PM
To: 'Rules Users List'
Subject: RE: [rules-users] Call a function from a function?

 

Thank you Shahad for your advise, but i doesn̵7;t help. I get still the error.

 

regards,

  michael

 

 

From: rules-users-bounceslists.jboss.org [mailto:rules-users-bounceslists.jboss.org] On Behalf Of Shahad Ahmed
Sent: Monday, May 19, 2008 3:57 PM
To: Rules Users List
Subject: Re: [rules-users] Call a function from a function?

 

Hi Michael,

 

I had a similar problem, but found that if I declared func2 before func1 (i.e. func2 appears above func1 in a drl file) then you can call func2 in func1. I'm not sure if this is a bug in drools or a limitation of the parser.

 

Regards

Shahad

On Mon, May 19, 2008 at 1:58 PM, Michael Katai <gmx.at">mk.othersgmx.at>; wrote:

Hello!

Is it possible to call a Function in a Function?

For example:

 rule
 ;  when
   then
     func1(data1, data2);
 end

 function void func1(MyClass1 data1, MyClass2 data2)
&nbsp;{
&nbsp;  func2(data1, data2);
 }

 function void func2(MyClass1 data1, MyClass2 data2)
&nbsp;{
&nbsp;}

When I do so, i get the error message:

func1 : Function Compilation error
func1 (line): The method func2(MyClass1, MyClass2) is undefined for the
type Func1

Any suggestions?
michael

_______________________________________________
rules-users mailing list
rules-userslists.jboss.org">rules-userslists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

 

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )