Is there any built-in component I can reference that would indicate in the loop 
below where $counter is less than the last item in the loop?

This would print the json for the return only when $counter=1, is simple way to 
know when $counter < LastItem?

let $outputJSON:=("{&#34;events&#34;:[",
let $config := json:config("full"),
                $cx := map:put( $config, "whitespace", "ignore" )
for $events at $counter in $search-this-partner/event
order by $events/EventStartDate/@date ascending
  return if($search-this-partner/event[$counter=1]) then
    fn:concat(json:transform-to-json( fn:doc($events/doc-uri), $config ), ",")
else
    "foo",
"]}")

>>
{"events":[
foo
Event object
foo
]}



_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to