I found the code on this website: http://www.botstation.com/code/view2excelweb.php
It mentioned the agent can export views in excel format, so I tried to use it.
I created an agent called "AgentTest" and paste the code inside.
I used a button to call the agent to perform the action.
This code set on click event (server side) for the button:
database.getAgent("AgentTest").run()
For the agent Basics part, I set the Runtime Trigger is "On event", Agent list selection and the Target is "None".
For the agent Security part, I checked the checkbox "Run as Web user" and choose " 2. Allow restricted operations" for the Runtime security level.
I saved everything and run the code, but I did not get excel file.
I tried to find out the problem use Debug LotusScript from Tools , however nothing happen when I click the button.
Grateful for your advice on this issue.
Thank you very much.
Yours faithfully,
beginner
(Edit for update)
I would like to ask one more question base on this website http://www.botstation.com/code/view2excelweb.php please.
Since the agent needs to call by URL, the website has been given an example: http://ServerName/YourDatabase.nsf/WebAgentName?OpenAgent&ViewNameToExport
I copy the URL and paste in Internet Explorer, the link can allow me to save or open the excel file. So I start to think to use the button to open the URL.
In the button, in Events, I choose Mouse onclick and put this code in the Script Editor:
print('http://ServerName/YourDatabase.nsf/WebAgentName?OpenAgent&ViewNameToExport');
The Internet Explorer shows the error "The website cannot display the page".
I also try this code for the button:
window.open('http://ServerName/YourDatabase.nsf/WebAgentName?OpenAgent&ViewNameToExport');
The Internet Explorer still shows the error.
I don't know why the error occurs. I visit this website http://www.w3schools.com/jsref/met_win_open.asp . The code should be fine if I use window.open.
My idea in the code is to display the URL in the window that ask me to open or save the excel file.
Grateful for your advice on this issue please.
Sorry for the inconvenience.
Thank you very much.