"from" followed by an expression means:

Take the elements of the collection or array returned by the
expression and evaluate the rule with each element.

Since a Fact() is not a Collection(), they are all filtered away:
nothing remains, and so the query returns nothing.

If you use
   $fact: Fact() from $tm.values()
and iterate over the query rows and extract the object bound to
"$fact" you'll get the Fact() things according to sort order.

-W

On 2 December 2011 10:42, Syargey <[email protected]> wrote:
> I am still wondering why the following query doesn't work:
>
> 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
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/facts-custom-sort-tp3538410p3554200.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> [email protected]
> https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to