0

[1]: https://i.stack.imgur.com/szHJJ.png [2]: https://i.stack.imgur.com/8Oic4.png There is an array, you need to pull the maximum value and its key from it. Each number from the array has its own key, and I need to pull exactly the one that is associated with the maximum number. With the help of regularity, I pulled out the numbers and through jsr 223, the sampler found the maximum number. Now the question is: how to extract the key of exactly the maximum number? Don't kick, a week since I started studying jmeter after lr, so I'm suffering. And the text was translated into English through a translator.

The key itself from part of the array (what needs to be pulled): dUUyTlFoUmhQMmExbCtFZ2VCY09uQT09LS1FK3lZbzJlakFUeEJoNlhCV3poRzV3PT0=--4814f46102fd5ecaf9f440be0a8925644927b3d0 described above the way to find the maximum number, in my case the number 69, now i need to somehow find the key to the maximum number and then apply it in the request.

Part of the array:

dUUyTlFoUmhQMmExbCtFZ2VCY09uQT09LS1FK3lZbzJlakFUeEJoNlhCV3poRzV3PT0=--4814f46102fd5ecaf9f440be0a8925644927b3d0" /><label class="collection_radio_buttons" for="challenger_order_selected_duuytlfoumhqmmexbctfz2vcy09uqt09ls1fk3lzbzjlakfueejonlhcv3porzv3pt0--4814f46102fd5ecaf9f440be0a8925644927b3d0">69</label></span></div>```

1 Answers1

0

You already have the value and even highlighted it in blue, just iterate through existing JMeter Variables values, get the match number and get the key which corresponds to the match number.

Example code:

for (int i = 1; i < (vars.get('maxValue_matchNr') as int); i++) {
    if (vars.get('maxValue_' + i + '_g2').equals(vars.get('maxValue_max'))) {
        vars.put('maxKey_max', vars.get('maxValue_' + i + '_g1'))
        break;
    }
}

You should be able to refer the extracted value as ${maxKey_max} where required.

Also using "regularity" for getting the values from HTML might not be the best idea, maybe it worth considering using CSS Selector Extractor instead?

Dmitri T
  • 159,985
  • 5
  • 83
  • 133