# 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/).

![](/files/-MciDqIiLlSaMQ6tYiGV)

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);}`

![](/files/-MciDyvYPtc2h9EkXD1u)

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.

![](/files/-MciF6YSr1QFrKCBLIDt)

Happy testing!

{% content-ref url="/pages/-MUT6iOSA6kWcHdMz1am" %}
[Features](/about-loadium/features.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MUQ5cTQeTV9Yioro2zC" %}
[Getting Started with Loadium](/getting-started.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MUSAunBwe2J09CIl1hu" %}
[JMeter Test](/create-test/jmeter-test.md)
{% endcontent-ref %}

{% content-ref url="/pages/MgN0OAuKVZtI6DuNx1bd" %}
[Pricing](/about-loadium/pricing.md)
{% 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.loadium.com/jmeter-corner/how-to-add-a-varying-number-of-parameters-in-apache-jmeter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
