I have tried the below mentioned xquery. If document is not managed I want to manage the document using a DLS query otherwise I want to checkout the document.
xquery version "1.0-ml";
import module namespace dls = "http://marklogic.com/xdmp/dls" at "/MarkLogic/dls.xqy";
let $uri :="/root/189966_01.xml"
let $i := dls:document-is-managed($uri)
return
if ($i = fn:false())
then
dls:document-manage($uri, fn:false(), "Baz is now a managed document")
(: dls:document-checkout($uri, fn:true(), "updating doc", 3600) :)
else if ($i = fn:true())
then
dls:document-checkout($uri, fn:true(), "updating doc", 3600)
else
"No action"
please correct me if anything is wrong on my side.
The xquery looks fine. Just a restructuring of the above query -
xquery version "1.0-ml";
import module namespace dls = "http://marklogic.com/xdmp/dls" at "/MarkLogic/dls.xqy";
let $uri :="/root/189966_01.xml"
let $i := dls:document-is-managed($uri)
return
if ($i = fn:false()) then
dls:document-manage($uri, fn:false(), "Baz is now a managed document")
else
if ($i = fn:true()) then
dls:document-checkout($uri, fn:true(), "updating doc", 3600)
else
()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With