Problem solve Get help with specific problems with your technologies, process and projects.

Export a search result view from Excel

How can I export a search result view from Excel (on the Web and with a LotusScript agent)?
Have a look at the method described at codestore.net, Keeping the boss happy. Basically you need an agent to write back the results to the Web user in a way that makes your browser recognize that it is an Excel file.
Print |Content-Type:
Print |<table border="1">
<tr><td width="80">Document titles
</td><td>document authors</td>
<tr><td>title number one</td>
<td>author number one</td></tr>
<tr><td>title number two</td>
<td>author number two</td></tr>

If you access an agent containing this code (from a browser using http://server/database.nsf/searchagentname?openagent), it will open up Excel displaying three rows and two columns.

So, what you need to do is have a Web-enabled form with a query field and a submit button. Put an agent name in the webquerysave event of the form. Let the agent access session.DocumentContext, and from there access the field containing the query. Do an ftsearch and then loop through the resulting documents, printing a new line containing something like this for each document:

Print |<tr><td>| & loopducment.
subject(0) & 
|</td><td>| & loopdocument.
authors(0) & |</td></tr>|

Do you have comments on this Ask the Expert question and response? Let us know.

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...