Extractor Pattern Returns Multiple Values - How do I get each value

Here is my extractor pattern:

; >Note:

;

;
;

~@NOTE@~

However in the scrapped file >Note: occurs multiple times and there is nothing distinguishable for each occurrence.

When I "apply pattern to last scraped data", it displays all the found values - Sequence 0 and the information --- Sequence 1 and the information.

My question is how do I to out.write each of sequence values?

I can get the first value, but that's it.

This is how I'm currently getting the data to a file:

out.write( session.getVariable( "NOTE" )+ "\t");

"After each pattern application"

jdhelle,

There are a handful of different ways you can handle this. The most common way would be to invoke your script "After each pattern application" rather than "After pattern is applied".

When you click the "Apply Pattern to Last Scraped Data" you'll see the results of all matches to your extractor pattern token (a complete DataSet). When you invoke a script "After pattern is applied" you are asking screen-scraper to take action only when all matches are found.

However, when you invoke a script "After each pattern application" then you are asking screen-scraper to take action each time it finds a match (individual DataRecord).

Unless otherwise necessary, it is best in this case to not save your variables as session variables and instead reference them by name as items in a DataRecord like so.

out.write( dataRecord.get("NOTE")+"\t");

When it makes sense to invoke a script "After pattern is applied" you can still iterate over the DataSet one DataRecord at a time. See the sample script, "Iterate over DataSets & DataRecords" for an example.

-Scott