try getProperty function.

Like so:  r.getProperty('rid')

On Tuesday, 23 June 2015 15:54:34 UTC-4, normanLinux wrote:
>
> I am in the early stages with orientdb.  As part of my preparation I am 
> trying to set up functions to handle POST input from Angular (where the 
> data will be sent in JSON format).
>
> I want to be able to access fields within the object, but have been unable 
> to find how to unpack it.
>
> My test function is deliberately very simple.  In studio I create a 
> function that takes  single parameter: record
>
> Function contents is:-
> var g=orient.getGraph(); // not needed for this test
> var r = record;
> var rid = r.rid;
> var v = r.val;
> return r;
> =======
> record contains:
> {rid:123,val:{name:"Norman",phone:"Home"}}
>
> return value is:
> [
>     {
>         "@type": "d",
>         "@version": 0,
>         "value": "{rid:123,val:{name:\"Norman\",phone:\"Home\"}}"
>     }
> ]
> ======================
> However, if I return rid (or v), I get nothing.
>
> Noting that the returned value, r, is an array containing a single object 
> I tried to return r[0] in the hope of accessing its members
> response was:
> [
>     {
>         "@type": "d",
>         "@version": 0,
>         "value": "{"
>     }
> ]
> I have looked anywhere that I can think of but have obviously missed the 
> answer.
> Could somebody please help me to see what I've got wrong?
> N.B. I have tried the keys in my object both with and without quotes - 
> same result.
>

-- 

--- 
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