Hi Tim,
Just leave out the braces, and replace $default with ().. J Cheers, Geert *Van:* [email protected] [mailto: [email protected]] *Namens *Tim *Verzonden:* woensdag 27 maart 2013 20:19 *Aan:* 'MarkLogic Developer Discussion' *Onderwerp:* [MarkLogic Dev General] How to program the order by clause in FLWOR? Hi Folks, Is there a simple way to program the order by clause in FLWOR to make it optional based on parameters? I have a web page that I want to sort as indicated by the user. For example, this code illustrates what I’d like to do but doesn’t work: let $sort-option := “a descending” return for $row in $rows let $a := $row/a/text() let $b := $row/b/text() order by *{if ($sort-option eq “a ascending”) then $a ascending else $default}*** return <tr><td>{$a}</td><td>{$b}</td></tr> Thanks! Tim Meagher
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
