Marko,
Thanks. My bad. I fixed the typo and it looks like the function is being called.
However, I run into this problem with variable 'it' being null inside the find() function. I tried having all in one call (like you had provided in the first example) as well as embedded within the function. Either case resulted in 'it' being null.
gremlin>> Cannot get property 'therapy|date' on null object
This is what's being defined in gremlin using the Doghouse tool:
def maxEdge(v)
{ x = v.outE('patient|hastherapy').property('therapy|date').max;
return v.outE('patient|hastherapy').find{it.getProperty('therapy|date') == x}
}
g.V('case|id',XXXXXX).outE('case|haspatient').inV.transform{maxEdge(it)}
I tried using this within a JUnit test case using Gremlin APIs and got a similar result. Not sure if find() function is loosing handle on the iterator.
Thanks,
Laksh