title: JMeter Nested Variable Reference with JDBC Resultset Variable and Counter Variable
body: <p>I need to query a MYSQL Database for a list of siteIDs and siteURLs. I've specified these names in the JDBC Request's Variable Name field.</p>
  
  <p>Then I created a ForEach Logic Controller to cycle through the siteURLs ${siteURL_1} till the last record from the result as such:</p>
  
  <pre><code>Input Variable Prefix: siteURL
  Start Index: 0
  End Index: 40
  Output Variable Name: newSiteURL
  </code></pre>
  
  <p>Then I use this in the HTTP Request's Path field as:</p>
  
  <pre><code>${newSiteURL}
  </code></pre>
  
  <p>This works fine and the HTTP requests are going through.</p>
  
  <p>Now, I want to name the HTTP Requests properly so that they are indexed better.
  For that, I decided to use the siteID field from the result set.</p>
  
  <p>To do that, I created a counter variable as such:</p>
  
  <pre><code>Start: 1
  Increment: 1
  Maximum: 40
  Reference Name: siteIndex
  </code></pre>
  
  <p>Now, to get the siteID from the result show in the corresponding HTTP Request, I edited the Name field of the HTTP Request to this:</p>
  
  <pre><code>${siteID_"({siteIndex})"}
  </code></pre>
  
  <p>But my HTTP Requests in the View Results Tree still end up showing as:</p>
  
  <pre><code>${siteID_"({siteIndex})"}
  ${siteID_"({siteIndex})"}
  ${siteID_"({siteIndex})"}
  ${siteID_"({siteIndex})"}
  ${siteID_"({siteIndex})"}
  ...
  </code></pre>
  
  <p>And not the actual siteID for the corresponding siteURL in the HTTP Request like:</p>
  
  <pre><code>21231
  12315
  21654
  64574
  76876
  ...
  </code></pre>