I'm using Web-Harvest to extract some data from a site.
Site gets a POST variable named Code
and gives data according to it.
The available codes are gathered from another page of that site.
How Can I define an array like variable to store those data that are related to a Code in a array like variable that make me able to retrieve them with a loop in main program?
I mean something like this:
Data[code1]={key1=val1, key2=val2, key3=val3,...}
Data[code2]={key1=val1, key2=val2, key3=val3,...}
Data[code3]={key1=val1, key2=val2, key3=val3,...}
Data[code4]={key1=val1, key2=val2, key3=val3,...}
...
You can use
<script>
tag and build an array inside it using BeanShell, Groovy or JavaScript. Default is BeanShell.Then expose it to your script with
SetContextVar()
method orreturn
attribute of the<script>
.Below is example that builds an array of strings
codes
and then iterates through them with<loop>
.Read more about
<script>
in the Web-Harvest manual.