# Feeder variable not getting stored as session variable

**URL:** <https://community.gatling.io/t/feeder-variable-not-getting-stored-as-session-variable/6404>\
**Category:** Gatling (Open-Source)\
**Created:** [January 25, 2022, 8:19pm UTC](https://community.gatling.io/t/feeder-variable-not-getting-stored-as-session-variable/6404 "2022-01-25T20:19:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maithrie\_Vaidyanatha](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@Maithrie\_Vaidyanatha](https://community.gatling.io/u/Maithrie_Vaidyanatha)\
**Post date:** [January 25, 2022, 8:19pm UTC](https://community.gatling.io/t/feeder-variable-not-getting-stored-as-session-variable/6404/1 "2022-01-25T20:19:40Z")

</div>

Hi All,

I am pretty sure I am wrong somewhere but not able to figure out (after watsing 2 days on this).

val scn = scenario(“RecordedSimulation”)  
.feed(patientfeeder) //has ids  
.exec(session =\> {  
val pid = session(“ids”).as[String]  
session.set(“patientid”,pid) // also tried session.set(“patientid”,session (“ids”).as[String])  
print(“value is ${patientid}”) // Won’t print patientid value  
println(session (“ids”).as[String]) //print the patientid value  
session}).pause(4)

I am not sure why it wouldn’t print, when I give as ${patientid} . I am also trying to use it like ${patientid} in a following request and it won’t resolve there as well.

Any feedback would really help !

Regards,  
Maithrie

---

<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:** [January 25, 2022, 11:23pm UTC](https://community.gatling.io/t/feeder-variable-not-getting-stored-as-session-variable/6404/2 "2022-01-25T23:23:11Z")

</div>

Please properly read the [Session API documentation](https://gatling.io/docs/gatling/reference/current/core/session/session_api/#setting-attributes), in particular the warning 🙂

---

<div class="post-metadata">

**Author:** ![kumarvinodg](https://avatars.discourse-cdn.com/v4/letter/k/f0a364/32.png) [@kumarvinodg](https://community.gatling.io/u/kumarvinodg)\
**Post date:** [February 11, 2022, 7:51pm UTC](https://community.gatling.io/t/feeder-variable-not-getting-stored-as-session-variable/6404/3 "2022-02-11T19:51:30Z")

</div>

looks like you have to exe session set first before to print in another exe method . i tested it and it is working ( use below code )  
.exec( session =\> session.set(“patientid”,session(“ids”).as[String])) // name is already available session variable either extract paramter or csv parameter

.exec(session =\> {  
val pid = session(“ids”).as[String]  
println(“patientid value is =”+ session(“patientid”).as[String]) // it print patientid value

println(“pid value is =”+pid)// it print pid value

session})
