Seems like I have resolved the problem instead of <lookup complexExpression="$fn.latestObs(90315,$visit.startDatetime).valueCoded.name"/>
there is a need to add single quotes around the velocity variable so that it can be evaluated hence <lookup complexExpression="$fn.latestObs(90315,'$visit.startDatetime').valueCoded.name"/>
works like a charm!!
3 Likes