title: Variable field in "Save Responses to a file" in jMeter -
body: <p>I've been beating myself up with jMeter to learn a few new things.  I am using 2.13.  One thing I played with yesterday is the "Save Responses to a file" listener.  I've put the path of the filename I want to create in the "Filename prefix" field and it seems to work well.</p>
  
  <p>Using the "Variable Name" field is more troublesome.</p>
  
  <p><a href="https://i.stack.imgur.com/6uktq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6uktq.png" alt="enter image description here"></a></p>
  
  <p>The Apache documentation says that the field is:</p>
  
  <blockquote>
    <p>Name of a variable in which to save the generated file name (so it can
    be used later in the test plan)</p>
  </blockquote>
  
  <p>Great!  I gave the variable a name and tried to access the value in a BeanShell PostProcessor script.</p>
  
  <pre><code>String startCode = vars.get("START_CODE");
  String filename = vars.get("FILENAME");
  String transNum = vars.get("TRANSACTION_NUM");
  System.out.println("startCode=" + startCode + ", transNum=" + transNum + ", filename=" + filename);
  </code></pre>
  
  <p>I always get null.  I've hacked at this a lot of my day yesterday.  I've tried pre-declaring the variable in a "User Defined Variables".  That will at least give me an empty string or whatever value I put in the Value column of the UDF.</p>
  
  <p>Gotta say I'm green on the BeanShell too, except my access to the other variables fetch the correct values, so it's a little confusing.</p>