diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/fhirpath/FHIRPathEngine.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/fhirpath/FHIRPathEngine.java index 74fd1aca6..a8399b4f5 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/fhirpath/FHIRPathEngine.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/fhirpath/FHIRPathEngine.java @@ -4743,6 +4743,8 @@ public class FHIRPathEngine { private ExecutionContext contextForParameter(ExecutionContext context) { ExecutionContext newContext = new ExecutionContext(context.appInfo, context.focusResource, context.rootResource, context.context, context.aliases, context.thisItem); + newContext.total = context.total; + newContext.index = context.index; // append all of the defined variables from the context into the new context if (context.definedVariables != null) { for (String s : context.definedVariables.keySet()) {