to get this work properly you need to do some mods:

   - in the function use the *size()* method instead of *count()* function 
   (because *out()* returns a collection)
   
return orient.getDatabase().query("SELECT out(hasComment).size() as 
countComment FROM Business WHERE @rid = " + idbusiness);



   - in the select use this syntax to get the clean result
   
select @rid,description,countComment(@rid).countComment[0] from business


<https://lh3.googleusercontent.com/-aOFS-O3aiUs/V_1Yskf_LKI/AAAAAAAAACE/dDCfXM-BMZE5dTWX6ojW0rLvuGAx55pwACLcB/s1600/Screenshot%2Bfrom%2B2016-10-11%2B23-25-38.png>

Il giorno sabato 8 ottobre 2016 00:19:59 UTC+2, Renzo Ludeña ha scritto:
>
> Hello friends, I created a function in orientdb studio use the version 
> 2.2.4 but when I called me back the same result for all
>
>
>
> <https://lh3.googleusercontent.com/-VFeOpGunTiI/V_gfGYS7SKI/AAAAAAAAAPU/ZStkhK4QAVAx7ZnwlJ8nfb2kQl_0bwIWQCLcB/s1600/Selection_025.png>
>
>
>
>
>
>
> <https://lh3.googleusercontent.com/-yuND7l_JOac/V_gfcfsiAZI/AAAAAAAAAPY/pdpR_mPOzxMFjsTNEisa9obl0Zsz2fIZACLcB/s1600/Selection_026.png>
>
>
> thanks for your help
>

-- 

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