Hi Erik,

I suppose the query result is wrapped with another hash before sending back.

Try following:
var results =  db.query("select name, city, state, zip from myclass");
*var out = results[0].name;*
return out;


Best regards,
Artem Orobets

* Orient Technologiesthe Company behind OrientDB*


2014-04-27 3:28 GMT+03:00 Erik Peterson <[email protected]>:

> In my server side JS function I need to transform values from a select
> statement and perform other tasks based on the results. But I can't seem to
> access the results with standard javascript/json. What am I missing? Using
> 1.7-rc1
>
>
> *myprocess function...*
>
> var results =  db.query("select name from myclass");
> return results;
>
> *correct result set is returned...*
>
> {
>
>    - result:
>    [
>       -
>       {
>          - @type: "d",
>          - @rid: "#-2:1",
>          - @version: 0,
>          - name: "Name1"
>          },
>       -
>       {
>          - @type: "d",
>          - @rid: "#-2:2",
>          - @version: 0,
>          - name: "Name2"
>          },...
>
>
> next try with myprocess function, do something with the results...
>
> var results =  db.query("select name, city, state, zip from myclass");
> var out = results.result[0].name;
> return out;
>
> gives error...
>
> Error on parsing script at position #0: Error on execution of the script
> Script: business
> ------^
> sun.org.mozilla.javascript.EvaluatorException: Java class
> "[Lcom.orientechnologies.orient.core.db.record.OIdentifiable;" has no
> public instance field or method named "result". (<Unknown source>#23) in
> <Unknown source> at line number 23
> Java class "[Lcom.orientechnologies.orient.core.db.record.OIdentifiable;"
> has no public instance field or method named "result". (<Unknown source>#23)
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OrientDB" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to