I got another related question.
If I invoke the scrapeableFile.extractData() method from a script. If the extractor pattern matches. Why can't I run a script after each pattern match? I know I can save the DataSet of the extractor pattern then loop over it in the script, is that the only way to do it?
When you invoke a script from within a script, the only variable that remains in scope is session. You can't access the variable scrapeableFile in the same way that you can when the script is called from the scrapeable file.
That being said, you can still accomplish what you're trying to do by storing scrapeableFile in a session variable. It might look something like this:
Another Question
Thanks for the help.
I got another related question.
If I invoke the scrapeableFile.extractData() method from a script. If the extractor pattern matches. Why can't I run a script after each pattern match? I know I can save the DataSet of the extractor pattern then loop over it in the script, is that the only way to do it?
That's the only way
That's the only way. Scripts aren't automatically run with manual extraction.
Script within script
When you invoke a script from within a script, the only variable that remains in scope is
session
. You can't access the variablescrapeableFile
in the same way that you can when the script is called from the scrapeable file.That being said, you can still accomplish what you're trying to do by storing
scrapeableFile
in a session variable. It might look something like this:In
script 1
:session.executeScript("script 2");
Then, in the
script 2
:DataSet ds = scrapeableFile.extractData(text, extractorPatternName);