Michael Sobczak
Michael Sobczak

Reputation: 1085

XAgent in Notes client

I've created an XAgent to export Notes data to Excel along the lines of the following:

http://www.dominoguru.com/pages/developer2010_xpagexlsexport.html

http://xpageswiki.com/web/youatnotes/wiki-xpages.nsf/dx/How_to_export_to_Excel_or_other_formats

The agent works fine the first time I run it in the Notes client. However, the second time I trigger the XAgent, I get the Location chooser letting me determine where to save the file, but nothing is ever downloaded. Worst of all, my Notes client locks up. I need to completely reboot my PC to get the XAgent to work again. I'm using Notes 8.5.3

When I run the agent within IE, it works fine every time.

Has anyone else experienced this behavior when exporting data via an XAgent running in XPiNC?

Upvotes: 1

Views: 800

Answers (1)

stwissel
stwissel

Reputation: 20384

I wouldn't recommend to use file emitting XAgents in XPiNC. You do have access to the file system after all. So it is easier to directly write to a file and then just display the link. If you follow my XAgent advise all your worker code would be in a class which you pass the Stream object, so you only have slightly different wrapper code around it.

So you would (pseudo-code)

 OutputStream out;
 if(runningInXPiNC()) {
    out = new FileOutputStream(new File(determineLocalFileName()));
 } else {
   out = getOutputStreamFromContextandResponseObject();
 }
 renderThatExelFile(out);

The rendered property of the page would be true for XPiNC, so you can display "Open the file" URL that points to "file://"+determineLocalFileName()

Upvotes: 1

Related Questions