If you would use what I posted it would work; it does with Drools 5.2.0.
If you change it so that it is incorrect then don't put the blame on me.
-W
On 1 December 2011 12:02, Syargey <Syargey(a)tut.by> wrote:
But I didn't check when I answered:
[ERR 101] Line 34:31 no viable alternative at input ')' in query
sortFactsQuery1 in pattern TreeMap
I tried:
query sortFactsQuery1
$tm: TreeMap()
from accumulate( $f: Fact(),
init( TreeMap map = new TreeMap(); ),
action( map.put(factKey($f), $f); ),
reverse( map.remove(factKey($f)); ),
result( map ) )
$sortedFacts: Collection() from $tm.values()
end
It doesn't return any results.
But the following query works:
query sortFactsQuery2
$tm: TreeMap()
from accumulate( $f: Fact(),
init( TreeMap map = new TreeMap(); ),
action( map.put(factKey($f), $f); ),
reverse( map.remove(factKey($f)); ),
result( map ) )
$sortedFacts: List()
from accumulate( $f: Fact() from $tm.values(),
collectList( $f ) )
end
--
View this message in context:
http://drools.46999.n3.nabble.com/facts-custom-sort-tp3538410p3551208.html
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users