# How to set counter in PUT request?

**URL:** https://community.gatling.io/t/how-to-set-counter-in-put-request/3386
**Category:** Gatling (Open-Source)
**Created:** [November 15, 2016, 12:44pm UTC](https://community.gatling.io/t/how-to-set-counter-in-put-request/3386 "2016-11-15T12:44:47Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@Peter](https://community.gatling.io/u/Peter)
#### Post date: [November 15, 2016, 12:44pm UTC](https://community.gatling.io/t/how-to-set-counter-in-put-request/3386/1 "2016-11-15T12:44:47Z")

</div>

Hi,

---

<div class="post-metadata">

### Author: ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)
#### Post date: [November 15, 2016, 12:50pm UTC](https://community.gatling.io/t/how-to-set-counter-in-put-request/3386/2 "2016-11-15T12:50:18Z")

</div>

If you have a proper look at the [documentation](http://gatling.io/docs/2.2.3/session/expression_el.html#expression-language), you’ll see that you can’t pass Scala code in Gatling EL expressions.  
There’s no way “${counter.get()}” could possibly work.  
You’d have to pass a function to build your String, not use Gatling EL.

---

<div class="post-metadata">

### Author: ![Peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@Peter](https://community.gatling.io/u/Peter)
#### Post date: [November 15, 2016, 1:32pm UTC](https://community.gatling.io/t/how-to-set-counter-in-put-request/3386/3 "2016-11-15T13:32:01Z")

</div>

Thanks for the reply.  
If possible can you please show any example how to implement this and pass that function to request?

---

<div class="post-metadata">

### Author: ![Nikolay\_Degkin](https://avatars.discourse-cdn.com/v4/letter/n/a6a055/32.png) [@Nikolay\_Degkin](https://community.gatling.io/u/Nikolay_Degkin)
#### Post date: [November 15, 2016, 3:34pm UTC](https://community.gatling.io/t/how-to-set-counter-in-put-request/3386/4 "2016-11-15T15:34:33Z")

</div>

This code works for me

`exec(http("test") .get(session =>s"""${counter}""") )`
