Noob alert, first post.

 

I have a rule that works fine when I run it in a JUnit test.  I've imported it into Guvnor (along with all my referenced pojos and functions) and it will not build there.  Here is the error:

 

Unable to Analyse Expression for (String curr : (List<String>) $validList) { ValidValue aValidVal = new ValidValue(curr); drools.insert(aValidVal); }; for (int i=0; i<$validList.size(); i++) { String curr = (String)$validList.get(i); ValidValue aValidVal = new ValidValue(curr); drools.insert(aValidVal); };: [Error: unexpected token: $validList] [Near : {... rr : (List<String>) $validList) { ....}] ^ [Line: 1, Column: 35]

 

What the rules is trying to do is run values from a set of records through a validation function and then add each of the valid values as individual facts.  Guvnor apparently doesn't like the way the iteration of the list is being done.  I've tried a few different ways of iteration.  Thanks in advance for any advice.

 

Here is the rule:

 

               when

                              $validList : List()

                                             from accumulate(

                                                            InRecord($value : value != ""),

                                                                           ListValid($value))

               then

                              for (String curr : (List<String>) $validList) {

                                             ValidValue aValidVal = new ValidValue(curr);

                                             insert(aValidVal);

                              }

                              for (int i=0; i<$validList.size(); i++) {

                                             String curr = (String)$validList.get(i);

                                             ValidValue aValidVal = new ValidValue(curr);

                                             insert(aValidVal);

                              }

 

Regards,

John Perrin

 

***************************************************************************
The information contained in this communication is confidential, is
intended only for the use of the recipient named above, and may be legally
privileged.

If the reader of this message is not the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.

If you have received this communication in error, please resend this
communication to the sender and delete the original message or any copy
of it from your computer system.

Thank You.
****************************************************************************