Pragya Kapoor
2010-05-19 13:37:03 UTC
Hi,
I have a query regarding the if-else statement in query.the code below describes the query:
let $entryid="1"
let $entry1:="1"
let $entry2:="2"
for $entry in doc("uri")//root/entry
where $entry/@id = $entryid
return
if (empty($entry))
then
$entry1
else
$entry2
Now if there is a entry with entryid=1 then it gives $entry2=2 . whereas if no entry exists with entryid=1 then it gives "no results". Please suggest me some other way to check the if condition so that I can get the desired result.
Thanks,
Pragya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20100519/a2375c04/attachment.html
I have a query regarding the if-else statement in query.the code below describes the query:
let $entryid="1"
let $entry1:="1"
let $entry2:="2"
for $entry in doc("uri")//root/entry
where $entry/@id = $entryid
return
if (empty($entry))
then
$entry1
else
$entry2
Now if there is a entry with entryid=1 then it gives $entry2=2 . whereas if no entry exists with entryid=1 then it gives "no results". Please suggest me some other way to check the if condition so that I can get the desired result.
Thanks,
Pragya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20100519/a2375c04/attachment.html