sort list by executionDate

19 views
Skip to first unread message

Ravi Mangalagiri

unread,
Apr 28, 2024, 2:32:28 PMApr 28
to Kogito development mailing list
Hi Kogito Community,
It's been a while, I hope everyone is going great. I got a quick question. How do we sort a list of objects by one of its properties?  

I attached a sample DMN.

Thanks
Ravi Mangalagiri
sortByDate.dmn

Gabriele Cardosi

unread,
Apr 29, 2024, 5:55:53 AMApr 29
to kogito-de...@googlegroups.com
Hi Ravi,
here's a working, strimmed down version of your original one.

The critical bit is

<dmn:literalExpression id="_71df1866-2b74-4d40-b4fd-0ebe860b27f1">
<dmn:text>sort(inputData, function(x, y) x.executedDate &lt; y.executedDate)</dmn:text>
</dmn:literalExpression>


See the sort function on DMN FEELHandbook (https://kiegroup.github.io/dmn-feel-handbook/#sort-list-precedes)
Best

Gabriele

--
You received this message because you are subscribed to the Google Groups "Kogito development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kogito-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kogito-development/CALg%3DC8OygL_nS2PegpJgc1VFpZifHoPSXZJT%3DkuCxWNyiYV%3D7Q%40mail.gmail.com.

Gabriele Cardosi

unread,
Apr 29, 2024, 5:56:58 AMApr 29
to kogito-de...@googlegroups.com
Hi Ravi,
here's a working, strimmed down version of your original one.

The critical bit is

<dmn:literalExpression id="_71df1866-2b74-4d40-b4fd-0ebe860b27f1">
<dmn:text>sort(inputData, function(x, y) x.executedDate &lt; y.executedDate)</dmn:text>
</dmn:literalExpression>


See the sort function on DMN FEELHandbook (https://kiegroup.github.io/dmn-feel-handbook/#sort-list-precedes)
Best

Gabriele

Il giorno dom 28 apr 2024 alle ore 20:32 Ravi Mangalagiri <ravi.man...@gmail.com> ha scritto:
--
SortedByDate.dmn

Ravi Mangalagiri

unread,
Apr 29, 2024, 7:28:49 AMApr 29
to Kogito development mailing list
Reply all
Reply to author
Forward
0 new messages