Writing the Search Term to a file?
Hi, this is slightly related to my previous post. How can I save the search term along with the data I am scraping?
In the example below, I am trying to save the session variable SEARCH along with the data I am extracting from the web page. However, it just returns null value.
Thanks,
Bhavesh
try
{
session.log( "Writing data to a file." );
// Open up the file to be appended to.
out = new FileWriter( "ASCO.txt", true );
// Write out the data to the file.
out.write( dataRecord.get( "SEARCH" ) + "\t" );
out.write( dataRecord.get( "DAY" ) + "\t" );
out.write( dataRecord.get( "DATE" ) + "\t" );
out.write( dataRecord.get( "START_TIME" ) + "\t" );
out.write( dataRecord.get( "END_TIME" ) + "\t" );
out.write( dataRecord.get( "ABSTRACT_TITLE" ) + "\t" );
out.write( dataRecord.get( "ABSTRACT_NUMBER" ) + "\t" );
out.write( dataRecord.get( "POSTER_NUMBER" ) + "\t" );
out.write( dataRecord.get( "PRESENTER" ) + "\t" );
out.write( dataRecord.get( "LOCATION" ) + "\t" );
out.write( dataRecord.get( "SESSION_TYPE" ) );
out.write( "\n" );
// Close up the file.
out.close();
}
catch( Exception e )
{
session.log( "An error occurred while writing the data to a file: " + e.getMessage() );
}
worked great!
thanks!
I wil try it now!
Noelle,
Thanks. I will try it now!
Bhavesh