Hi Chinmay
you are using orient.getGraph();
the query will return OrientVertex instead of Document
try record.getProperty("name");
Enrico
2014-08-28 13:09 GMT+02:00 Chinmay Shrikhande <[email protected]>
:
> Hi Luca,
>
> Thank you for your inputs. I tried executing the following ofunction with
> the modifications:
>
> var gdb = orient.getGraph();
> var roles = gdb.command("sql","select from ouser");
> roles.forEach(function(record) {
> // Code to access each record.....????
> // Something like record.name - which will give me the value for name
> attribute of the current record
> try {
> print(record.field("name"));
> } catch(exp){
> print("Exception occured");
> print(exp);
> }
>
> });
> return roles;
>
> Following is the error that occured: TypeError: Cannot find function field
> in object v(OUser)[#5:0].
>
> Please can you provide me some more inputs on this.
>
> On Thursday, August 28, 2014 3:56:10 AM UTC+5:30, Lvc@ wrote:
>
>> Hi Chinmay,
>> the result contains OrientDB Java ODocument instances, so you can do:
>>
>> record.field("name");
>>
>> Lvc@
>>
>>
>>
>> On 27 August 2014 21:02, Chinmay Shrikhande <[email protected]>
>> wrote:
>>
>>> Hello,
>>>
>>> I am using orientdb version 1.7.8. I am trying to access the resultant
>>> records of a query for further processing. Following is the sample
>>> ofunction that i have written in 'Javascript' language:
>>>
>>> var gdb = orient.getGraph();
>>> var roles = gdb.command("sql","select from ouser");
>>> roles.forEach(function(record) {
>>> // Code to access each record.....????
>>> // Something like record.name - which will give me the value for name
>>> attribute of the current record
>>> });
>>> return roles;
>>>
>>> Please suggest, as to how can i access each record and its attributes.
>>>
>>> Thanks,
>>> Chinmay Shrikhande
>>>
>>> --
>>>
>>> ---
>>> 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.
>
--
---
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.