Q

Export a search result view from Excel

This Content Component encountered an error
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:
application/vnd.ms-excel|
Print |<table border="1">
<tr><td width="80">Document titles
</td><td>document authors</td>
</tr>
<tr><td>title number one</td>
<td>author number one</td></tr>
<tr><td>title number two</td>
<td>author number two</td></tr>
</table>|

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.

This was first published in November 2004

Dig deeper on LotusScript

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • 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 ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close