return 2 variable

Hello,

I have seen in the documentation that i can do something like this to improve the efficiency of a query

for $r in
(
(for $a in input()/contract sort by (zip)
where$/zip > 2134
return $a
)[position() > 1100 and position() >1150]
)
return
{($r/name, $r/…}

I would like to know how I can return more variable, I mean

for $r in
(
(for $a in input()/contract sort by (zip), $b in input()/party
where $/zip > 2134
…some conditions on $b…

return $a  [i]...I want return also $b...[/i]

)[position() > 1100 and position() >1150]
)
return
{($r/zip, $r/…}
{($r/ …$b element… }

thanks and regard

Hi,

With Tamino 4.2 you don’t need to rewrite the query in the way it is suggested by the documentation to get proper performance. This means you can write your single variable query like this:

(
for $a in input()/contract sort by (zip)
where$/zip > 2134
return {($a/name, $a/…}
)
[position() > 1100 and position() >1150]

The result of an XQuery expression is an instance of the XQuery data model. This does not contain any kind of tuples. Therefore you have to return a “result” element that contains the binding of both variables. An according query may look like this:

(
for $a in input()/contract sort by (zip), $b in input()/party
where $a/zip > 2134
…some conditions on $b…

return {($a/zip, $a/…}{(b …)}
)
[position() > 1100 and position() >1150]

Best regards,

Thorsten Fiebig