Search code examples
apijmeterresponse

Jmeter array Response, getting the sum and extracting Part2


I want to get the sum of values parameters and multiply by 3,

{ "timestamps": "2021-04-15T11:39:00Z", "properties": [{ "values": [1, 2, 3, 4], "name": "Value.Restricted", "type": "Long" }], "progress": 100.0 }

Kindly see attached file for your reference. Thank you so much in advance

Screenshot


Solution

    1. To get the sum of these values attribute you can use JSON JMESPath Extractor, example query:

      sum(properties[0].values)
      

      Demo:

      enter image description here

    2. If you want to multiply it by 3 - it can be done using i.e. __jexl3() function:

      ${__jexl3((${sum} * 3),)}
      

      it will return floating point number like 10.0 if you need just 10 - call intValue() chain function

      ${__jexl3((${sum} * 3).intValue(),)}
      

    enter image description here