xquery:eval and bindings argument

Saturday, 17 June 2017 · 2 messages
BK
Buddy Kresge17 Jun 2017 19:01 #
I apologize in advance, because I know the answer will be simple (but I couldn't find an example and have tried all sorts of options). I am trying to run xquery:eval passing in a string to evaluate and a map of bindings. Everything I try I get an 'Undefined variable' error. Here is a simple example I tried in the BaseX Gui. let $a := 3let $string := "$a + 1"returnxquery:eval($string, map{"a" : $a} This is just one attempt, but there were many others. Again, I know this is going to be a simple mistake I'm making, so apologies to the community in advance. Thanks, Buddy
CG
Christian Grün17 Jun 2017 23:34 #
Hi Buddy, You’ll need to add a variable declaration in the query string; see [1] for examples. Hope this helps, Christian [1] http://docs.basex.org/wiki/XQuery_Module#xquery:eval
Quoted text · Buddy Kresge · 24 lines
On Sat, Jun 17, 2017 at 7:01 PM, Buddy Kresge <buddyonweb-software at yahoo.com> wrote: > I apologize in advance, because I know the answer will be simple (but I > couldn't find an example and have tried all sorts of options). > > I am trying to run xquery:eval passing in a string to evaluate and a map of > bindings. Everything I try I get an 'Undefined variable' error. > > Here is a simple example I tried in the BaseX Gui. > > let $a := 3 > let $string := "$a + 1" > return > xquery:eval($string, map{"a" : $a} > > This is just one attempt, but there were many others. > > Again, I know this is going to be a simple mistake I'm making, so apologies > to the community in advance. > > > Thanks, > > Buddy

⚡Generated with XQuery