How to Extract vector in session?

Hi,

I have saved vector in session and I want to use random value from the vector but dont know how to extract value in session.

Errors:
1.
'httpRequest-6' failed to execute: Vector(437420, 443940, 443932, 437437, 443981, 443956, 443973, 443915, 437445) named 'termIds' does not support .random function

And

2. In 2nd scenario It passes vector in get request like this way,

http://someurl/api/thr/Vector(435854)/terms/Vector(437420, 443940, 443932, 437437, 443981, 443956, 443973, 443915, 437445)

instead of using
http://someurl/api/thr/435854/terms/443973

::Here is my script::

`
class getTerm extends Simulation {

val repeatCount = Integer.getInteger(“repeatCount”, 1).toInt
val userCount = Integer.getInteger(“userCount”, 1).toInt
val turl = System.getProperty(“turl”, “some url”)

val httpProtocol = http
.baseURL(“http://” + turl)

val headers_10 = Map(“Content-Type” → “”“application/json”"")

var thrIds = “”
var termIds = “”

// Scenario - 1
val getTerms = scenario(“Scn 1”)
.exec(http(“list_of_term”)
.get("/api/abc")
.headers(headers_10)
.check(jsonPath("$[*].id")
.findAll.saveAs(“thrIds”))
)

.exec(http(“get_all_terms”)
.get("""/api/thr/${thrIds.random()}/terms""")
.headers(headers_10)
.check(jsonPath("$[*].id")
.findAll.saveAs(“termIds”))
)

.exec(session => {
thrIds = session(“thrIds”).as[Long].toString
termIds = session(“termIds”).as[Long].toString
println(“")
println("Session ====>>>> " + session)
println("Ths ID ====>>>> " + thrIds)
println("Term ID ====>>>> " + termIds)
println("
”)
session}
)

// Scenario - 2
val getKnownTerms = scenario(“Get Known Term”)
.exec(.set(“thrIds”, thrIds))
.exec(
.set(“termIds”, termIds))

.repeat (repeatCount){
exec(http(“get_k_term”)
.get("""/api/thr/${thrIds}/terms/${termIds.random()}""")
.headers(headers_10))
}

val scn = List(getTerms.inject(atOnceUsers(1)), getKnownTerms.inject(nothingFor(20 seconds), atOnceUsers(userCount)))
setUp(scn).protocols(httpProtocol)

}
`

Hi Peter,
you can try

.exec(http("Random item") .get("api/thr/" + "${thrIds.random()}" + "/terms") )