Search code examples
jmeter

How to use jdbc request response results in http post request


I have used JDBC request to get required data, JDBC Request

  • Results in debug sampler:

Results in Debug sampler

  • Stored in variable:

Results in Variable

Note: I need to use this isccode=[{scheme=ISC, code=O0004170}] here scheme & code are combination I need to use in HTTP request.

  • POST Request:

HTTP Post request

Note: I should not use [variables names] as per organization norms I should use [Result Variable name].


Solution

  • If your "organization norms" disallow using Variable Names the "organization" should give you the guidance on how you should work with the "Result Variable Name"

    However if you prefer asking random people in the Internet to do your job for you here you go:

    It's stored as ArrayList of HashMaps, for getting "code" from the first row you can use i.e. __groovy() function like:

    ${__groovy(vars.getObject('isccode')[0].get('code'),)}
    

    for scheme it would be correspondingly

    ${__groovy(vars.getObject('isccode')[0].get('scheme'),)}
    

    More information on Groovy scripting in JMeter: Apache Groovy: What Is Groovy Used For?