The semicolon works in a main module. If you need to do the same in a library module, use xdmp:eval() and do the update in a different transaction. More info in the Application Developer's Guide: http://docs.marklogic.com/guide/app-dev/transactions#id_24388
-- Dave Cassel Developer Community Manager MarkLogic Corporation<http://www.marklogic.com/> MarkLogic World - San Francisco April 13 - 17<http://world.marklogic.com/locations/san-francisco/> From: Sudheer Yalaverthi <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Friday, March 27, 2015 at 12:02 PM To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Subject: Re: [MarkLogic Dev General] How to display updated document right after update query Classification: Public Hi Danny, You can end the transaction with semi colon. Then in the same x-query, access the document and return it. For ex. (: This is the first transaction where update happens:) declare variable $uri as xs:string := "/doc/sample.xml"; let $doc := fn:doc($uri) return xdmp:node-replace($doc/update-node, element new-node { "new text"}) ; (:This is the second transaction where you can read the changes from first transaction :) (: Variables, imports, namespaces must be defined again here.:) declare variable $uri as xs:string := "/doc/sample.xml"; fn:doc($uri) From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Danny Sinang Sent: Friday, March 27, 2015 11:54 AM To: general Subject: [MarkLogic Dev General] How to display updated document right after update query I've an update query that replaces a node within a document. The node replacement works, but the requirement is for the same query to return the contents of the updated document. I know this isn't normally possible since the update query doesn't do a commit till after the query is executed. Anybody know of a workaround for this ? Regards, Danny --- This communication may contain confidential and/or privileged information. If you are not the intended recipient (or have received this communication in error) please notify the sender immediately and destroy this communication. Any unauthorized copying, disclosure or distribution of the material in this communication is strictly forbidden. Deutsche Bank does not render legal or tax advice, and the information contained in this communication should not be regarded as such.
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
