I have a loop controller with an If controller inside of it. The if controller triggers on certain loop iterations to update a Jmeter variable (SystemId). The If controller and groovy script seem to work correctly, however, outside of the if controller the Jmeter variable (SystemId) seems to reset to the value before the If controller executed?
I have put debug samplers/post processors to check the state of the Jmeter variables inside and outside the if controller. The debug inside the loop shows the SystemId variable updated the very next element is the outside sampler which shows the SystemId reverted to the previous value.
I have tried various java, groovy, and beanshell approaches to changing the variable. All work with the sampler inside the if controller showing the variable changed, but all still result in the variable value being reverted outside of the if controller as shown by the sampler outside the if controller.
Edit: Added if controllers and debug sampler/postprocessors
<IfController guiclass="IfControllerPanel" testclass="IfController" testname="If2 Controller">
<stringProp name="IfController.condition">"${SysCounter}"=="2"</stringProp>
<boolProp name="IfController.evaluateAll">false</boolProp>
<boolProp name="IfController.useExpression">false</boolProp>
</IfController>
<hashTree>
<JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="If2 set SystemId">
<stringProp name="scriptLanguage">groovy</stringProp>
<stringProp name="parameters"></stringProp>
<stringProp name="filename"></stringProp>
<stringProp name="cacheKey">true</stringProp>
<stringProp name="script">vars.put("SystemId",vars.get("BellowsId"))</stringProp>
</JSR223Sampler>
<hashTree>
<DebugPostProcessor guiclass="TestBeanGUI" testclass="DebugPostProcessor" testname="If2 Inside Debug">
<boolProp name="displayJMeterProperties">false</boolProp>
<boolProp name="displayJMeterVariables">true</boolProp>
<boolProp name="displaySamplerProperties">true</boolProp>
<boolProp name="displaySystemProperties">false</boolProp>
</DebugPostProcessor>
<hashTree/>
</hashTree>
</hashTree>
<DebugSampler guiclass="TestBeanGUI" testclass="DebugSampler" testname="Outside If2 Debug">
<boolProp name="displayJMeterProperties">false</boolProp>
<boolProp name="displayJMeterVariables">true</boolProp>
<boolProp name="displaySystemProperties">false</boolProp>
</DebugSampler>