I am using a screen scraping tool to pull data and output into a CSV. It works perfectly unless a session variable does not exist. I want to change my code to say, if this variable does not exist, replace with value 0.
E.G. If Session.getVariable "Figure2" is not present use value 0.
session.log( "Writing data to a file." );
out = new FileWriter( "C:/Users/Documents/Live/data.CSV" );
out.write ("User, Figure 1,Figure 2, Figure 3, Figure 4 ");
out.write ("\n");
out.write ( "User" ) ;
out.write (",");
out.write ( session.getVariable( "Figure1" ) );
out.write (",");
out.write ( session.getVariable( "Figure2" ) );
out.write (",");
out.write ( session.getVariable( "Figure3" ) );
out.write (",");
out.write ( session.getVariable( "Figure4" ) );
out.close();
session.log( "Writing data to a file." );