Create DataSet Manually From Script From Session Variables

Hi,

I am just looking at this software again to see if it will work for my project. One issue I cannot seem to find the answer to on your site is regarding creating a dataset manually. I could automatically but I want to add in a column that is saved in a session variable. But I am getting an error. I have a script run after each pattern match.

if(session.getVariable("DATASET_CREATED") == null)
{
billPayPhonesDataSet = new DataSet();
session.setVariable("DATASET_CREATED", "1");

}

record.put("PHONE_COST", session.getVariable("PHONE_COST"));
record.put("PRODUCT_ID", session.getVariable("PRODUCT_ID"));

//Add the datarecord to the dataset
billPayPhonesDataSet.addDataRecord(record);

I took it that a dataset would always be stored in memory and be global for the length of the scrape but it does not seem to be. Any help would be really appreciated.

Yeah that works perfectly

Yeah that works perfectly thanks

Could be done

What you describe could be done, but I think it would be easier to just use a Java HashSet or HashTable (depending on your needs).

Have a script make a new HashSet at the beginning of the scrape, and save it as a session variable, then when you want to add to it

session.getv("YOUR_NAME").add("value");