I cannot used dynamic valude during the request time

Hello everyone
Please help me
I write this code
When I want to get a dynamic value and when I use this dynamic value during the request body it does not generate or I cannot use this value

The request body is written as this type

body:FormUrlEncodedRequestBody{patchedContentType='null', charset=UTF-8, content=age=30&name=Test+Name&description=Test+Request&token1=%23%7Btoken1%7D&token2=%23%7Btoken2%7D}

I write 2 example userFeeder1 and userFeeder2

My code is there

package tests

import io.gatling.core.Predef.*
import io.gatling.core.feeder.Feeder
import io.gatling.core.scenario.Simulation
import io.gatling.http.Predef.*

class FirstTestCase extends Simulation {

  private val httpProtocol = http
    .baseUrl("https://test.test.com")
//    .inferHtmlResources(BlackList(""".*\.js""", """.*\.css""", """.*\.gif""", """.*\.jpeg""", """.*\.jpg""", """.*\.ico""", """.*\.woff""", """.*\.woff2""", """.*\.(t|o)tf""", """.*\.png""", """.*detectportal\.firefox\.com.*"""), WhiteList())
    .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9")
    .acceptEncodingHeader("gzip, deflate")
    .acceptLanguageHeader("en-US,en;q=0.9,az;q=0.8,tr;q=0.7")
    .contentTypeHeader("application/x-www-form-urlencoded")
    .originHeader("https://test.test.com")
    .upgradeInsecureRequestsHeader("1")
    .userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36")

  private val headers_0 = Map(
    "sec-ch-ua" -> """Chromium";v="104", " Not A;Brand";v="99", "Google Chrome";v="104""",
    "sec-ch-ua-mobile" -> "?0",
    "sec-ch-ua-platform" -> "macOS",
    "sec-fetch-dest" -> "document",
    "sec-fetch-mode" -> "navigate",
    "sec-fetch-site" -> "same-site",
    "sec-fetch-user" -> "?1"
  )

  val Age = "30"
  val Name = "Test Name"
  val Description = "Test Request"

  def generateToken: Map[String, String] = {
    val tokens = (Age.length + Age + Name.length + Name + Description.length + Description).toString().toLowerCase()
    Map(
      "token1" -> tokens
    )
  }

  val userFeeder1: Feeder[String] = Iterator.continually(generateToken)

    val userFeeder2: Feeder[Any] =
      Iterator.continually(
        Map(
          "token2" -> "dfngvdndksfdslfkdsergerfewrwehewrhwefnsdnf"
        )
      )
  val search =
  exec(http("request_0")
    .post("/test/test")
    .formParam("age", _ => Age)
    .formParam("name", _ => Name)
    .formParam("description", _ => Description)
    .formParam("token1", _ => "#{token1}")
    .formParam("token2", _ => "#{token2}")
  )

  val scn = scenario("Scenario Name")
    .feed(userFeeder1)
    .feed(userFeeder2)
    .exec(search)

  {
    setUp(
      scn.inject(rampUsers(1).during(1))
    ).protocols(httpProtocol)
  }
}

pom XML is there

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.gatling.tests</groupId>
  <artifactId>gatling_scala_project</artifactId>
<!--  <version>2.0-SNAPSHOT</version>-->

<!--  <properties>-->
<!--    <maven.compiler.source>1.8</maven.compiler.source>-->
<!--    <maven.compiler.target>1.8</maven.compiler.target>-->
<!--    <encoding>UTF-8</encoding>-->

<!--    <gatling.version>3.8.4</gatling.version>-->
<!--    <gatling-maven-plugin.version>4.2.7</gatling-maven-plugin.version>-->
<!--    <maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>-->
<!--    <maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>-->
<!--    </properties>-->

    <version>3.8.4</version>

  <properties>
    <!-- use the following if you're compiling with JDK 8-->
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <!-- comment the 2 lines above and uncomment the line bellow if you're compiling with JDK 11 or 17 -->
    <!--    <maven.compiler.release>11</maven.compiler.release>-->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <gatling.version>${project.version}</gatling.version>
    <gatling-maven-plugin.version>4.2.7</gatling-maven-plugin.version>
    <maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
    <maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.gatling.highcharts</groupId>
      <artifactId>gatling-charts-highcharts</artifactId>
      <version>${gatling.version}</version>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-app</artifactId>
      <version>${gatling.version}</version>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-recorder</artifactId>
      <version>${gatling.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.11</version>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>;
      <artifactId>guava</artifactId>
      <version>23.0</version>
    </dependency>
  </dependencies>

  <build>
    <testSourceDirectory>src/test/scala</testSourceDirectory>
    <plugins>
      <plugin>
        <groupId>io.gatling</groupId>
        <artifactId>gatling-maven-plugin</artifactId>
        <version>${gatling-maven-plugin.version}</version>
      </plugin>
    </plugins>
  </build>
</project>

This is wrong. As explained in the documentation, Gatling Expression Language only works when used for directly passing a String parameter to a Gatling method, not inside functions.

In your case, you really don’t need functions:

.formParam("token1",  "#{token1}")
    .formParam("token2",  "#{token2}")

This is an example code
In real-time, I generate there dynamic value
For example random number and so on
How can I write?
can you show me an example in this code?

I read this ticket and do it as this ticked

[How to send one more request the same time - #2 by sbrevet](https:// How to send one more request the same time)

I change code and it work now

.body(StringBody(s"""age =$age& name =$name& description =$description& token1=#{token1}& token2 =$token2"""))