Hi Rahul,

Without seeing how you are calling this function, it is hard to know for sure, 
but I suspect you need to check the status in another transaction.  You can use 
the semi-colon separator (using the 1.0-ml dialect) to do this in cq.  
Something like:

xquery version "1.0-ml";
local:updateStatus() 
;

xquery version "1.0-ml";
//status

For details about the transactional semantics in MarkLogic Server, check out 
the "Understanding Transactions in MarkLogic Server" chapter in the Application 
Developer's Guide (http://developer.marklogic.com/pubs/4.1/books/dev_guide.pdf).

-Danny

From: [email protected] 
[mailto:[email protected]] On Behalf Of Rahul Saluja
Sent: Monday, October 12, 2009 2:50 PM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] help with replace function

hello all, please help me to suggest that following function will work in order 
to replace the value of status element or not, if yes then, how as in my case 
it is not , if no then why .
I know node-replace doesn't work on in memory elements but my documents are 
stored in database once i call this function and then using CQ i check the 
value of status element for the constructed result, it is still the same.

declare function local:updateStatus()
{

let $b :=cts:search(
//books,
cts:and-query((

cts:element-word-query
(
xs:QName("title"),xdmp:get-request-field("Title") , 

("wildcarded", "case-insensitive")

),cts:element-word-query
(
xs:QName("status"),xdmp:get-request-field("Status") , 

("wildcarded", "case-insensitive")

)
))
)
return
(
xdmp:node-replace($b//status,
<status>{ xdmp:get-request-field("Status")}</status>)
,
xdmp:redirect-response("success.xqy")
)
};

Looking forward to your response.

Regards
Rahul Saluja
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to