# How to Add a Varying Number of Parameters in Apache JMeter

Some requests have more than one parameter, and the number of parameters may change. You can also add dynamic parameters according to your scenario.

To resolve this issue, JSR223 PreProcessor provided by [JMeter](https://loadium.com/blog/functional-testing-with-loadium-apache-jmeter/) can be used.

First, we add an [HTTP request](https://loadium.com/blog/4-things-you-should-know-about-http-requests/) as shown below, then **we delete all the parameters** and add JSR223 [PreProcessor](https://loadium.com/blog/how-to-add-a-variable-number-of-parameters-in-apache-jmeter/).

![](https://33973752-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MUOy4kHWrKkuqX5mhH7%2F-MciD-11DEsgH8ynRzLp%2F-MciDqIiLlSaMQ6tYiGV%2Fimage.png?alt=media\&token=3bc09a8d-6f88-40a4-9076-f61dafc052ad)

In this example, we choose the groovy language.

Then we add a for loop to determine how many parameters we will add, and add the parameter insert code to use it inside the for a loop.

`for(int i=1; i<=10; i++){sampler.AddArgument("ParameterName"+i, "Value"+i);}`

![](https://33973752-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MUOy4kHWrKkuqX5mhH7%2F-MciD-11DEsgH8ynRzLp%2F-MciDyvYPtc2h9EkXD1u%2Fimage.png?alt=media\&token=6d3bfb35-2f99-4b08-91bf-4f704e25450e)

When we run the [test](https://loadium.com/blog/jmeter-distributed-testing-step-by-step/), we add any number of parameters as shown in the figure.

![](https://33973752-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MUOy4kHWrKkuqX5mhH7%2F-MciD-11DEsgH8ynRzLp%2F-MciF6YSr1QFrKCBLIDt%2Fimage.png?alt=media\&token=d1959079-78dd-448f-a169-707bca918c6a)

Happy testing!

{% content-ref url="../about-loadium/features" %}
[features](https://wiki.loadium.com/about-loadium/features)
{% endcontent-ref %}

{% content-ref url="../getting-started" %}
[getting-started](https://wiki.loadium.com/getting-started)
{% endcontent-ref %}

{% content-ref url="../create-test/jmeter-test" %}
[jmeter-test](https://wiki.loadium.com/create-test/jmeter-test)
{% endcontent-ref %}

{% content-ref url="../about-loadium/pricing" %}
[pricing](https://wiki.loadium.com/about-loadium/pricing)
{% endcontent-ref %}

If you don't see the answer to your question here, please [reach out to us](https://loadium.com/contact-us/) to let us know! We're always improving our documentation.
