"tf:getInoId" and "max"

Hello!

Software:
- Windows 2000 + Service Pack 3
- Tamino 4.1.4
- Internet Explorer 6 & Mozilla 1.5

I tried to use the following xquery:


-------------------------------
declare namespace ino=“http://namespaces.softwareag.com/tamino/response2
declare namespace tf=“http://namespaces.softwareag.com/tamino/TaminoFunction
for $b in input()/doc
where tf:getInoId($b) = max($b/@ino:id)
return $b
-------------------------------


Unfortunately this xquery seems to hang… and after some minutes I got:

-------------------------------
<?xml version="1.0" ?>
<ino:response xmlns:ino=“http://namespaces.softwareag.com/tamino/response2”>
<ino:message ino:returnvalue=“8201”>
<ino:messagetext ino:code=“INOXHE8201”>Can’t connect to server mydb, XTS error code -85.</ino:messagetext>
</ino:message>
</ino:response>
-------------------------------

Also this xquery closed my database ‘mydb’ and I must again start my database. I got also that repair process was executed because of abnormal termination.

How should I modify this xquery to make it work?
In advance, thanks a lot!

best regards,
Dariusz Baumann

Hello Dariusz, please report this to your local customer support center in order to obtain a fix to the problem.

best regards,

Stuart Fyffe-Collins
Software AG (UK) Ltd.

Hello Dariusz,
the behaviour is certainly a bug.
But apart from that I do not understand your query.
First there is no implicit ino:id attribute in
XQuery formulations.
Thus the formulation would be:
for $b in input()/doc
where tf:getInoId($b/…) = max(tf:getInoId($b/…))
return $b

However that is alway true for each document.
Thus you probably meant the document with the highest inoId:

for $b in input()/bib
let $maxInoId := max( for $c in input()/bib return tf:getInoId($c/…) )
where tf:getInoId($b/…) eq $maxInoId
return $b

Easier is and optimized is:

(
for $b in input()/bib
return $b
sort by (tf:getInoId(…) descending)
)[position() eq 1 ]

Best regards
Walter