The Expert documentation states "The expression used to define the object source is any expression
that follows regular MVEL syntax." Therefore "from" should be able to use the MVEL syntax for arrays ["one", "two", "three"] however I've not tried and never seen it used. Normally people use "from" to iterate over a dynamic list created elsewhere (another Fact pattern, a global etc). Since you say you need to handle "variable collections" I'd have thought the latter use-case more suitable for yor needs. something like:-
when
$pch : ParsedCellHolder( )
$val : String( ) from $pch.getStrings( )
then
insert( new Fact( $val ) );
end
Of course one begs to ask why you don't simply insert the individual values into WM as the spreadsheet is parsed?
You'll be doing something like that to either construct the static MVEL in your example or a list.
With kind regards,
Mike
Hello all,
In one of my use cases, I need to insert a variable collections of facts
into working memory in order to be able to test for those values later :
So I was wondering if there's a way to do something like this
when
$vals : String() from [ "A 12345", "B 45678", "C 8695" ]
then
insert ( new Fact ( $vals ) );
With the intention that the rule will fire 3 times and insert the 3 new
facts with the values " A 12345" and "B 45678" and "C 8695".
Is this possible using rules or do I have to resort to using functions. The
problem I'm trying to overcome is to see if there's a way to get the "A
12345", "B 45678", "C 8695" from a single cell of a spreadsheet.
Thanks in advance,
G
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Is-it-possible-to-Iteriate-over-a-list-of-string-values-tp2654135p2654135.html
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users