Hello,
optimization across the element constructor is currently not done. Therefore you should specify also the position filter before the element construction.
See hint in future 4.2 documentation:
Element construction
Optimization is currently not done across element construction. Therefore element construction should be postponed to the end of the result construction, for example:
Instead of:
( for $a in input()/contact sort by (zip)
where $a/street eq “AStreet”
and $a/zip gt 2134
return
{($a/name, $a/street,$a/zip)}
sort by (zip)
)[position() > 1100 and position() < 1150]
Use:
for $r in
(
(for $a in input()/contact sort by (zip)
where $a/street eq “AStreet”
and $a/zip gt 2134
return $a
)[position() > 1100 and position() < 1150]
)
return
{($r/name, $r/street)}
Best regards
Walter
#webMethods-Tamino-XML-Server-APIs#API-Management#webMethods