Hi all, I don't know if that helps.
*1- *Here is how we (Isilex) do multiple tests before inserting a node while we redirect at the same time the user to another web Page using db:output :
try { *db:output(*rest:redirect/</rest:redirect>), (:Redirection:) if($isi:testid2) then if (db:open('site')//texts[name=$idPage]/text[@lang=$lg]) then for $x in db:open('site')//texts[name=$idPage]/text[@lang=$lg] return* replace node $x* with html:parse($node, map { 'nons': true() }) *(:Insert 1:)* else if (db:open('pages')//page[name=$idPage]) then *replace node* db:open('pages')//page[name=$idPage] with html:parse(normalize-space($node), map { 'nons': true() }) else if (not(fetch:xml(normalize-space($node), map{'chop': true()})//name = ('','Titre de la page','Page title','Nom','Name'))) then *insert node *html:parse(normalize-space($node), map{'nons': true()}) into db:open('pages')/root *(:Insert 2:)* else *db:output*(rest:redirect/err:save</rest:redirect>) else *db:output* (isi:template(isi:t('unauthorized_access'))) } catch * { fn:error(xs:QName('err:save'), $node) } };
*2-* Here is how we save a file onto a disk and at the same time we redirect a user to another web page:
(db:output(rest:redirect/myUrl</rest:redirect>) , file:write($filePath,$css,map { "method": "text"}) )
Hope We helped,
2017-11-18 10:00 GMT+01:00 Christian Grün christian.gruen@gmail.com:
You might want to try db:output. See our documentation on performing returning updates and returning output.
Am 18.11.2017 01:44 schrieb "E. Wray Johnson" wray.johnson@gmail.com:
How can I white a single XQUERY statement that assigns an auto-generated id to a node (using either generate-id(), or random:uuid() ) then inserts the node into a database and then returns the auto-generated id.
I can do the id assignment and insert operation just fine using { }, I just don't know how to return the id afterward