Hi all,
i have a problem when i want to call function with variables from session as parameters:
`
.check(regex(""“data-page=”(\d).2" data-question""").findAll.saveAs(“list1”))
.check(regex(""“data-page=”(\d).2" data-question""").count.saveAs(“count1”))
`
which found (2, 5).
Then i have this function “spustanie” which calls another function “footer”
`
def spustanie(var_list:List[String],var_count:Int)={
for (i ← 0 to var_count-1) {
var lst2 = var_list(i).toString
var re2 = lst2
if (i == var_count-1) re2
else{
re2 = (lst2.toInt + 1).toString
}
footer (lst2+",2",re2)
}
}
`
I have tried something like
`
.exec(session => {
spustanie(session(“list1”).as[List[String]],session(“count1”).as[Int])
session
})
`
which just doesnt seem to work.
Thanks in advance for any help. 
Sorry i forgot, im using Gatling 2.1.6
Hm, it’s not clear to me what your problem is. What are you expecting to happen and what did happen?
From what I can see, I’m guessing that you mean session(“list1”).as[List[String]] is not returning a List[String]?
Looking at the documentation, http://gatling.io/docs/2.1.6/http/http_check.html?highlight=findall, findall saves the attribute as a Seq[T], which could be your problem. But please elaborate.
Thanks for response.
My “list1” returns List (2, 5), but when i try to call function like “.exec(spustanie($list1, count1))” it tells me that variable is not defined. 
Dňa štvrtok, 25. júna 2015 18:56:45 UTC+2 Andrew Krischer napísal(-a):
If you call println(session) just before calling spustanien what do you see?
I get this:
Session(teotest89,7029719221769583319-0,Map(count1 -> 2, count2 -> 2, list1 -> List(2, 5), list2 -> List(0, 3), Ziak_id -> F000000060, <cookies and stuff> ... ),1435150367172,22,OK,List(),<function1>)
And when i try something like this:
`
.exec(spustanie(list1,count1))
`
it gives me “not found: value list1” and “not found: value count1”
Dňa štvrtok, 25. júna 2015 19:18:40 UTC+2 Stéphane Landelle napísal(-a):
Are you sure you’re saving and pulling from the SAME virtual user?
Could you post a full gist?
sure, here it is:
https://gist.github.com/anonymous/5426cbf7446c3fe10bb7
Dňa piatok, 26. júna 2015 7:47:51 UTC+2 Stéphane Landelle napísal(-a):
Sorry, but this doesn’t compile:
.exec(spustanie(list1,list2,count1,count2))
That is the thing. I dont know how to call “spustanie” with value “list1” as parameter, because it says "not found: value list1 "
Dňa piatok, 26. júna 2015 8:07:08 UTC+2 Stéphane Landelle napísal(-a):
The original way is supposed to work:
.exec(session => {
spustanie(session(“list1”).as[List[String]],session(“count1”).as[Int])
session
})
That way its compiled OK, it just doesnt really run that function.
`
begin (OK=1 KO=0 )
zacat testovanie2 (OK=1 KO=0 )
notify_zacat (OK=1 KO=0 )
logout (OK=1 KO=0 )
`
Dňa piatok, 26. júna 2015 8:20:39 UTC+2 Stéphane Landelle napísal(-a):
Now I get it. A perfect example of “it doesn’t work” is not the proper way of reporting an issue.
You can’t try to trigger requests from an exec(function).
If you want to have conditional blocks, you have to use the proper DSL components, such as doIf.
Ah i see.
I changed logic a little, now i can use only “repeat”.
Thank for all help 
Lukas
Dňa piatok, 26. júna 2015 8:57:52 UTC+2 Stéphane Landelle napísal(-a):