06-25-2007 01:31 PM - edited 03-14-2019 12:59 AM
I would like to save the date stored in a variable to an xml or txt file and cannot figure out how to do it. Any assistance will be appreciate.
06-25-2007 06:57 PM
Is this for UCCX or UCCE? If the latter, is this using IPIVR or CVP?
Do you know your Java?
Regards,
Geoff
06-25-2007 08:35 PM
UCCX and no not at all(Java). I am a quick learner though!!
06-26-2007 09:02 AM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide