Hello,
I have a Patient schema which has Date node in different levels.
I want to run a query in which any of these Date nodes equal to a specific Date.
I can run this query in X-Query as follows and runs perfect.
Patient[//Date=“2001/11/09”]
How can I run same query as an XQuery?
I tried this but didn’t work
for $x in input()/Patient[//Date=“2001/11/09”]
return $x
Thanks
Server
Hello.
Could you please give some further details on why your query didn’t work?
I tried the following query with the Real Estate data, and it worked:
for $a in input()/Property[//State=“NY”]
return $a
(The State element is in the Address element, which is a direct child of Property.)
As this works for me, I suspect that your problem is caused by something other than your query…
To answer your quertion - you could convert the filter to a where clause:
for $a in input()/Property
where $a//State=“NY”
return $a
You could also write the long-hand version:
for $a in input()/Property
where $a/descendant-or-self::State=“NY”
return $a
Greetings,
Trevor.
Hello,
I tried
for $a in input()/Property[//State=“NY”] return $a
and it works.
But in Property schema the State node occurs only at one place.
I my schema the Date occurs at different places.
like this :
Patient
Case
Exam
Date
Control
Date
Inpatient
Date
The query gives error like :
<ino:message ino:returnvalue=“9291”>
<ino:messagetext ino:code=“INOXYE9291”>Transaction aborted because it has taken too long</ino:messagetext>
Query should return 7 documents.
I have over 90.000 documents in the database (its a large size database about 200 MB data)
Hello there.
Could you please tell us about the schema - specifically about the indexes on the Date elements?
Could you please also tell us which four-digit version of Tamino are you using?
Is there a particular reason for using //Date= rather than a more specific query? Perhaps something like this:
for $a in input()/Patient
let $b := "2001/11/09"
where $a/Case/Exam/Date = $b
or $a/Control/Date = $b
or $a/Inpatient/Date = $b
return $a
I’d be interested to know if the timeout also occurs when querying on the exact nodes.
Greetings,
Trevor.
There was a problem that “no index for //-paths detected”. They say it’s solved in Tamino Update Kit 4.1.1.9. Maybe this will help…
Hello,
I have installed Tamino Update Kit 4.1.1.9 and now it works.
Many thanks Alexander