[rules-users] facts custom sort
Syargey
Syargey at tut.by
Thu Dec 1 06:02:14 EST 2011
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.
More information about the rules-users
mailing list