0
votes

I need some enlightenment in using Xpages and Lotusscript.

I have an export button in Xpages, that takes the ID as parameter sends it to Lotus script agent, which than uses that id to fetch data from web service and exports it to .csv. The agent was tested and is working. And when i run the Xpages in notes and try to export data it's working, the file is shown in folder that is designed to. But when the Xpage is running from the browser (chrome, mozilla) and export is pushed nothing happens. Do i have to use some other way to export data?? Can you give me some explanation how to export data from browsers

4

4 Answers

0
votes

Where are you testing the agent and where are you looking for the file?

When XPages runs from a browser, all that can ever run on the browser is client-side JavaScript. Any of your back-end code (SSJS etc) runs on the server, the LotusScript agent will also run on the server. So if the LotusScript agent is creating and saving a CSV file to a folder, it will save it to that folder on the server.

Exports running from a browser will typically return HTML or other content that the PC can interpret as needing to be opened in a certain program, e.g. Excel. But you would need to save the code in a Notes Document, then access the document and print the result back to the browser.

There are open source projects like OpenCSV that have Java libraries for outputting a stream of CSV data for a browser. (It's not Apache-licensed, so can't be put on OpenNTF under the Apache license.)

2
votes

I can recommend the POI4XPages project on OpenNTF. Export of views made easy

0
votes

Easiest tweak is to redirect agent's output to "console" - so instead of printing to file (Open File, then Print #1 for example) use ordinary Prints. Also add content-type header.

In XPages you can specify agent's url (http(s)://server/path to nsf/agent?OpenAgent) and browser will get agent's response - what is exactly your CSV. It downloads and opens in Excel, usually.

0
votes

Make sure to change the security setting of your agent to "Run As a Web User". Otherwise, this agent will not run.