title: JMeter - If Controller not working for certain string contains condition?
body: <p><strong>Background:</strong><br>
  I have an API that returns a response like so:</p>
  
  <pre><code>{
    "status": 1,
    "errorCode": null,
    "message": null,
    "data": [
      {
        "id": 33,
        "snapshotId": 2,
        "ceId": 29,
        "month": "Feb",
        "corpRcvPayAmt": 100000,
        "wthRcvPayAmt": -90000
      },
      {
        "id": 31,
        "snapshotId": 2,
        "ceId": 29,
        "month": "Jan",
        "corpRcvPayAmt": 0,
        "wthRcvPayAmt": 0
      }
    ]
  }
  </code></pre>
  
  <p>The <code>data</code> node can vary from 0 size to 12 (empty to 1 per month). The only constant field for <code>data</code> is the <code>"month"</code> node. Other field values are changing.</p>
  
  <p><strong>Goal:</strong><br>
  I want to do either a <code>PUT</code> or a <code>POST</code> request, depending on whether or not a specific month is already present in <code>data</code>.</p>
  
  <p>For this, I'm capturing the entire <code>data</code> field into a variable using a <strong>Regular Expression Extractor</strong> like this:
  <a href="https://i.stack.imgur.com/R6azI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R6azI.png" alt="enter image description here"></a></p>
  
  <p>With the sample response above, calling <code>${data}</code> will give me <code>{"id":33,"snapshotId":2,"ceId":29,"month":"Feb","corpRcvPayAmt":100000.00,"wthRcvPayAmt":-90000.00},{"id":31,"snapshotId":2,"ceId":29,"month":"Jan","corpRcvPayAmt":0.00,"wthRcvPayAmt":0.00}</code></p>
  
  <p>Now using this field, I just want to do a simple if condition like so: if <code>${data}</code> contains <code>${month}</code> do something (PUT request). I'm currently trying to do it like this:</p>
  
  <p><a href="https://i.stack.imgur.com/sYmD1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sYmD1.png" alt="enter image description here"></a></p>
  
  <p><strong>Problem:<br></strong>
  The condition <code>${__groovy("${data}".contains("Jan"))}</code> does not seem to work.
  I've already tried doing the following:</p>
  
  <p><li> change the condition to <code>${__groovy("${month}".contains("Jan"))}</code> just to see if the syntax is correct. This works just fine.
   <li> Add a debug sampler inside the if controller using the condition <code>${__groovy("${month}".contains("Jan"))}</code> to print <code>${data}</code>. This also prints the data as expected.<a href="https://i.stack.imgur.com/wGTWV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wGTWV.png" alt="enter image description here"></a>
   <li> I also tried using various js syntax for the if condition but so far groovy is the ongiving the best results. </p>
  
  <p>With this I can confirm the following:
   <li> <code>${month}</code> and <code>${data}</code> are extracted and stored properly
   <li> groovy syntax for string contains is working properly
   <li> for some reason, the condition <code>${__groovy("${data}".contains("Jan"))}</code> is not working.</p>
  
  <p>What am I missing here? Thanks in advance.</p>