How can i build a simple increment for variable $a by Xquery such as ?
let $a := 0
for $i in (1 to 10)
let $a := $a + 1
why $a value in this loop always is '1'.
Thank you for reading, its will really helpful for my job if i can solve this problem.
I think the op might mean otherwise.
In fact, the xquery variables (say $a here) are "immutable"... you can think of it that the assignment statement is evaluated left to right rather than like procedural language right to left. But the figurative description is only suggestive. Eventually, it means that $a is first set up anew when the statement is encountered, then it is assigned a value $a+1 which is then 1 each time!
Instead, use the keyword "at" for this specific construction.