Re: [rules-users] How to limit results from a collect statement

2007-08-23 Thread pentarious
I just opened a JIRA: http://jira.jboss.com/jira/browse/JBRULES-1115. Regards, CG Edson Tirelli-3 wrote: > >I do suggest you open a JIRA and attach your test case. I will need to > do > some debugging to understand what is happening. > >[]s >Edson > > 2007/8/22, pentarious <[EMA

Re: [rules-users] How to limit results from a collect statement

2007-08-22 Thread Edson Tirelli
I do suggest you open a JIRA and attach your test case. I will need to do some debugging to understand what is happening. []s Edson 2007/8/22, pentarious <[EMAIL PROTECTED]>: > > > I hope you can help me find a solution. In the meantime I've tried your > workaround, adding an addOption()

Re: [rules-users] How to limit results from a collect statement

2007-08-22 Thread pentarious
I hope you can help me find a solution. In the meantime I've tried your workaround, adding an addOption() method with no success. When I use that method in the rule I get the following exception (and I can't understand why): java.lang.ClassNotFoundException: org.test.ItemShadowProxy org.test.Item

Re: [rules-users] How to limit results from a collect statement

2007-08-22 Thread Edson Tirelli
I think I know what is happening. The getOptions() method is returning the shadowed options collections, i.e., when you are adding the option, you are adding to the shadow instead of the real object. Now, I'm not sure how we should handle such thing, since we do need to shadow the options co

Re: [rules-users] How to limit results from a collect statement

2007-08-22 Thread pentarious
Actually, before opening a JIRA I would like to show you my actual code... Here it is: rule "My Rule" no-loop true when $list : ArrayList() from collect( Item( type == "MY TYPE" ) ) then Item item = (Item) $list.get(0); ItemOption option = new ItemOption( item

Re: [rules-users] How to limit results from a collect statement

2007-08-22 Thread Edson Tirelli
Well, it must work. Can you open a JIRA with a self contained test case please? I will investigate. []s Edson 2007/8/22, pentarious <[EMAIL PROTECTED]>: > > > I know. Actually I didn't put any update or insert statement in the code > just > to make it simpler. The actual code looks like

Re: [rules-users] How to limit results from a collect statement

2007-08-22 Thread pentarious
I know. Actually I didn't put any update or insert statement in the code just to make it simpler. The actual code looks like: when $itemList : ArrayList() from collect( Item( category == "VIDEO" ) ) then ItemDiscount disc = new ItemDiscount(10); insert(disc); $myFirstItem =

Re: [rules-users] How to limit results from a collect statement

2007-08-22 Thread Edson Tirelli
If you want the "engine to see" your changes, in a way you affect other rules, you must call update( object ) for the object you are changing. Otherwise, the change will happen to the original object, but not to the shadow proxy that the engine uses to ensure consistency. []s Edson 2007/

Re: [rules-users] How to limit results from a collect statement

2007-08-22 Thread pentarious
Ok, I'm still working on that, I'll publish my solution asap. In the meantime it turns out our requirements need something more than that. We have an ordered list of beans (items) and we have to be able to modify a specific subset of the list (adding a discount). Now I tried to solve this problem

Re: [rules-users] How to limit results from a collect statement

2007-08-21 Thread Edson Tirelli
Please, share with us! Send to the list! Edson 2007/8/21, pentarious <[EMAIL PROTECTED]>: > > > I found an interesting implementation to do that. If anyone is interested > I > could share my solution. > > Regards, > > CG > > > Mark Proctor wrote: > > > > There is no supported way to do th

Re: [rules-users] How to limit results from a collect statement

2007-08-20 Thread pentarious
I found an interesting implementation to do that. If anyone is interested I could share my solution. Regards, CG Mark Proctor wrote: > > There is no supported way to do this. You could use an inline-eval > against a global, but that is very clunkey. However it does seem like a > good featur

Re: [rules-users] How to limit results from a collect statement

2007-08-08 Thread Cristiano Giuffrida
Thanks, I'll do that. In the meantime I still need to get the job done asap. Can you provide me an example to implement such a logic using an inline-eval and global (which variable should be global?)? And just out of curiosity can you explain me why this code doesn't work (basically why, after the

Re: [rules-users] How to limit results from a collect statement

2007-08-08 Thread Mark Proctor
There is no supported way to do this. You could use an inline-eval against a global, but that is very clunkey. However it does seem like a good feature idea for a future release, open a jira and I'll look into getting it included. Mark pentarious wrote: Does anyone know a method to limit the

[rules-users] How to limit results from a collect statement

2007-08-08 Thread pentarious
Does anyone know a method to limit the number of results from a collect statement? I was just wondering how to do something like this: $myList : List() from collect( MyObject(myField == "something") ) limit 3 //it should put in $myList just the first 3 objects retrieved I'm quite sure there is not