?Hi Mike,
I read this blog, but I am unable to make 2 update statements as separate statements separated by semicolon as I have to check a condition based on which I need to update the document using dls library Please look into the below code for details. Thanks Pragya ________________________________ From: [email protected] <[email protected]> on behalf of Michael Blakeley <[email protected]> Sent: Monday, December 22, 2014 12:33 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] XDMP-CONFLICTINGUPDATES Take a look at https://blakeley.com/blogofile/2013/06/21/introduction-to-multi-statement-transactions/ - it talks about using MST with DLS. -- Mike On Dec 21, 2014, at 22:17, Kapoor, Pragya <[email protected]<mailto:[email protected]>> wrote: Hi, I need to run multistatement transcations in if else using dls library . The below code is throwing error XDMP-CONFLICTINGUPDATES please let me know, what is the solution to this problem. Moreover, I tried running the below code with declare option xdmp:transaction-mode "update";? and using xdmp:commit() but still the same problem. I need to get the documents from a directory, the first document is version 1 of the doc, the second document in the directory is version 2 of the doc. Code: for $FileEntry in $sortList let $Filename := functx:substring-after-last(xdmp:node-uri($FileEntry),'/') let $count := fn:count(fn:tokenize($Filename,'_')) let $docUri := if($count=5) then fn:concat($PrefixURI,functx:substring-before-last($Filename,'_'),'.xml') else fn:concat($PrefixURI,$Filename) let $contents := $FileEntry let $logsXML := if (fn:doc-available($docUri) eq fn:false()) then try{ (: Insert the document :) (dls:document-insert-and-manage( $docUri, fn:false(), $contents, "created", (xdmp:permission("dls-user", "read"), xdmp:permission("dls-user", "update")), "historic"), xdmp:document-add-collections( $docUri, "latest"), xdmp:document-remove-collections( $docUri, "historic"), (: Create metadata :) local:createMetadata($docUri,$contents), local:createEvents($docUri,$contents), local:insertPDF($transId) ), ( <uris> <uri>{$docUri}</uri> <status>Success</status> <info>Document inserted</info> <transId>{$transId}</transId> </uris> ) } catch($e) { <uris> <uri>{ $docUri }</uri> <status>Failure</status> <info>{ $e/error:format-string/text() }</info> <transId>{ $transId }</transId> </uris> } else try{ (: Update the document :) let $update:= ( dls:document-checkout-update-checkin( $docUri, $contents, "updated", fn:true(), (), ("historic")), xdmp:document-add-collections( $docUri, "latest"), xdmp:document-remove-collections( $docUri, "historic"), (: Update metadata :) local:updateMetadata($docUri,$contents), local:createEvents($docUri,$contents), local:insertPDF($transId) ) return ( <uris> <uri>{$docUri}</uri> <status>Success</status> <info>Document inserted</info> <transId>{$transId}</transId> </uris> ) } catch($e) { <uris> <uri>{ $docUri }</uri> <status>Failure</status> <info>{ $e/error:message/text() }</info> <transId>{ $transId }</transId> </uris> } "This e-mail and any attachments transmitted with it are for the sole use of the intended recipient(s) and may contain confidential , proprietary or privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this e-mail or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful." _______________________________________________ General mailing list [email protected]<mailto:[email protected]> http://developer.marklogic.com/mailman/listinfo/general "This e-mail and any attachments transmitted with it are for the sole use of the intended recipient(s) and may contain confidential , proprietary or privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this e-mail or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful."
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
