"If-Else" Help
trying to create an if-else script that will write information only if a "COST" is greater than "PRICE".
cost = Float.parseFloat(dataRecord.get("COST"));
{
if (COST >= NEWCOST) {
session.scrapeFile( "CreateColumns" );
}
System.out.println("Grade = " + grade);
}
}
I'm receiving the following error:
ERROR--New Scraping Session: An error occurred while processing the script: Test2
New Scraping Session: The error message was: class bsh.EvalError (line 8): ) { -- illegal use of undefined variable, class, or 'void' literal.
Thanks,
Ben
Is there any way to execute another script in screenscraper from
Thanks for the redirection. Here is the successful code if needed.
outputFile = "filename.txt";
COST = Float.parseFloat(session.getv("COST"));
NEWCOST = Float.parseFloat(session.getv("NEWCOST"));
{
if (COST >= NEWCOST) {
try
{
session.log( "Creating Master upc List." );
out = new FileWriter(outputFile, true );
out.write( dataRecord.get( "COST" ) + "\t" );
// Close up the file.
out.close();
}
}
System.out.println("Grade = " + grade);
}
Is there any way to execute another script in screenscraper from a script?
Look at the API for
Look at the API for executeScript and executeScriptWithContext.
I don't think your script is
I don't think your script is complete. I don't see where NEWCOST is set. I also see that you set cost, but compare to COST--Java is case sensitive so you need to have it the same both places.