I'm trying to use the simple mapping operator (!) as below
(1,7,2,4,5)!(.)
The above would return 1,7,2,4,5 as a sequence.But I need the values to be sorted in ascending order.
Is it possible to use order by with this mapping operator?If so,please share an example to do the same.
Thanks!
Unfortunately,
fn:sort()is not currently available in MarkLogic.The easiest way to achieve what you want is probably a FLWOR, as Martin Honnen suggested.
The functx libraries are installed and available in MarkLogic, so you could leverage
functx:sort():Or you could create your own custom function wrapping that FLWOR with
order by.