Unanswered question

How can I create JavaScript variables that behave like variables created by a variable extractor?

I have an array that is filled by JavaScript. I then want to use the values in this array as I would do when using a variable extractor.

Eg. Array = "arrListOfNames" containing 100 names.
Variable Extractor 'extListOfIds' containing 100 extracted values.
extListOfIds_matchNr gives the total number of values (100) and each value can be called using extListOfIds_n (n = number from 1 to 100). I want to be able to use my javascript array the same way, like arrListOfNames_matchNr or arrListOfNames_n, without having to create a seperate NeoLoad variable for each item in the array. Is it possible to push a JS array to a NeoLoad variable? I went to this because the NeoLoad lists can't be used like listname_n.

Joris V.
Joris V.

Joris V.

Level
0
14 / 100
points

Answers

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

In any case, i think that you will have to create in your Javascript as many variables as values. But you can create them using a loop with the right format.

For example in your JS you could have something like that: context.variableManager.setValue("arrListOfNames_"+index,MyArray[index]); so each index of your array will create a variable arrListOfNames_n that you can call like any variable extractor.

Does it make sense?

Joris V.
Joris V.

Joris V.

Level
0
14 / 100
points

@ Nouredine A., thank you for your response. Well, this is the situation I am in, but this really looks dirty to me :s, if it's possible with Variable Extractors, why not with a single dimension JS Array :-)