     @name = json.name
 
   exec: (ctx) ->
-    ctx.get(@name)?.exec(ctx)
+    value = ctx.get(@name)
+    if value instanceof Expression  
+      value = value.exec(ctx)
+    value
+      
 
 # Parameters
 

    a
      
  forEach: (ctx, func) ->
    @records ||= @expression.exec(ctx)
    self = @
    results = for rec in @records
      rctx = new Context(ctx)
      rctx.set(@alias,rec)
      if @rest
        rest.forEach(rctx,func)
      else
        func(rctx)
    results
 
allTrue = (things) ->
  if typeIsArray things
    if things.length > 0
      things.reduce (a,b) -> a && b
    else
      true
  else
    things


    while p = ctx.currentPatient()
      patient_ctx = ctx.childContext({"PATIENT" : p})
      for key,expr of @expressions when expr.context is "PATIENT"
        r.recordPatientResult(patient_ctx.currentPatient().id, key, expr.exec(patient_ctx))
      ctx.nextPatient()
    r
