hello,
I tried same thing, but gives me error:
TypeError: result[0].field is not a function in <eval>
On Wednesday, 14 November 2012 16:07:16 UTC+5:30, Lvc@ wrote:
>
> Hi Fabrizio,
> try something like:
>
> var rs = db.query("select Name,Surname,Address from Person");
> for( r in rs ){
> var record = rs[r];
> var name = record.field("Name");
> var surname = record.field("Surname");
> }
> return rs;
>
> Lvc@
>
>
>
> On 14 November 2012 11:26, Fabrizio <[email protected] <javascript:>>
> wrote:
>
>> I'm writing a simple function in Javascript using OrientDB Studio. I have
>> a query SELECT:
>>
>> var rs = db.query("select Name,Surname,Address from Person");
>> return rs;
>>
>> Output is:
>>
>> {
>> "result": [{
>> "@type": "d", "@rid": "#-2:1", "@version": 0,
>> "Name": "Marco",
>> "Surname": "Rossi",
>> "Address": "Via XXX"
>> }, {
>> "@type": "d", "@rid": "#-2:2", "@version": 0,
>> "Name": "Luca",
>> "Surname": "Neri",
>> "Address": "Via YYY"
>> }
>> ]
>> }
>>
>> Now, my purpose is to read the ResultSet, Person by Person, and for each
>> of them use some field.
>> In a nutshell, I would like to do what in Java is done in this way:
>>
>> while(rs.next() ) {
>> String Name = rs.getString("Name");
>> String Surname = rs.getString("Surname");
>> String Address = rs.getString("Address");
>> ...................
>> }
>>
>> Can anyone help me?
>>
>> Thanks,
>> Fabrizio
>>
>> --
>>
>>
>>
>>
>
>
--
---
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.