That's cool.


One problem with writing to a file is concurrency. What happens if two calls come in at exactly the same time and execute the Java code at the same time, trying to open a file that the other already has open? Nasty business.


You would be better off writing to a database which has protection for concurrency.


That said ... there's probably a lot of ways to skin this particular pussy ... so here's one.


1. Declare an int variable to hold the return value of a Java snippet. It's not really useful, but we need it to make the expression editor work.


2. Add a Set step.


3. Right click Properties


4. Set the variable to the one you just created using the drop down list. It's an integer so our Java snippet will return an integer - in fact, the value 1.


5. click on the little ... to open the expression editor


6. put the Editor into Java mode


7. Insert something like this (don't forget the start and end curly braces)


{

java.io.FileWriter fw = null;

String fileName = "C:\\temp\\foo.txt";

try

{

fw = new java.io.FileWriter(fileName, true);

fw.write("something");

fw.close();

}

catch (java.io.IOException ex)

{

}

return 1;

}


8. Hit OK in the Expression Editor


9. Hit OK in the Set step.


10. Give it a shot.


Regards,

Geoff



Attachment: 

Actions

This Discussion