Hi danny, if you could spare some time would really appreciate
here is the function
xquery version "1.0-ml";
(: last_try.xqy :)
declare function local:updateStatus()
{
let $previousStatus := xdmp:get-request-field("previousStatusValue")
let $recievedStatus := xdmp:get-request-field("newStatusValue")
let $recievedYear := xdmp:get-request-field("Year")
let $recievedUri := xdmp:get-request-field("calculatedUri")
let $recievedTitle := xdmp:get-request-field("Title")
let$b :=
xdmp:node-uri(cts:search(
//books,
cts:and-query((
cts:element-word-query
(
xs:QName("title"),"*" ,
("wildcarded", "case-insensitive")
),cts:element-word-query
(
xs:QName("status"),"" ,
("wildcarded", "case-insensitive")
)
))
))=$recievedUri
return
if ($b) then
(
xdmp:node-replace($previousStatus,
<status>{ $recievedStatus }</status>)
,
xdmp:redirect-response("success.xqy")
)
else
<span>Could not locate book with title { $recievedTitle }.</span>
};
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Update In Process</title>
</head>
<body>
Redirecting
page.
<p>
Error:
<br/>
{
local:updateStatus() }
</p>
</body>
</html> and it is called by file attached every time i run it i get
500 Internal Server Error XDMP-ARGTYPE: (err:XPTY0004) xdmp:node-uri(()) --
arg1 is not of type node()
in /update-write.xqy, on line 12,
in local:updateStatus() [1.0-ml] $previousStatus = """"
$recievedStatus = "hello"
$recievedYear = ()
$recievedUri = "/documents/book4"
$recievedTitle = ()in /update-write.xqy, on line 53 [1.0-ml]
could you please help me its bit urgent.
Regards
Rahul Saluja
On Tue, Oct 13, 2009 at 6:46 AM, Danny Sokolsky <
[email protected]> wrote:
> It takes a node that exists in the database (1st arg) and replaces it
> with the specified new node (2nd arg). This performs an update to the
> database.
>
>
>
> -Danny
>
>
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *Rahul Saluja
> *Sent:* Monday, October 12, 2009 2:11 PM
> *To:* General Mark Logic Developer Discussion
> *Subject:* [MarkLogic Dev General] how xdmp:node-replace works
>
>
>
> hello all,
>
> can anyone with briefly explain how xdmp:node-replace works .
>
> regards
> Rahul Saluja
>
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
>
>
update-main-searchresult.xqy
Description: Binary data
_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
