Subject: search functionality
Hi Ravi,
For presenting the results in the $$View Template you can
construct HTML representation, where you will include the document parameters. Will be something like this:
dim msg as string
dim server as string
dim dbpath as string
'now retrieve server, dbpath values. Use a profile to store the
values or get the server and dbpath using CGI Variables. Refer Notes help for table of CGI variables. Something like Server_Name & @WebDBName will do the trick.
'then begin constructing your HTML with the necessary URL
'computation for each matching document.
'now construct HTML for search results
msg=msg+{<a href=“http://”}+cstr(server)+{“/”}+cstr(dbpath)+{“/viewname/”}+cstr(doc.UniversalID)+{“/?Opendocument”>}+cstr(doc.Title)+{}
'in the code above, if the document has a title or any suject then just show it(the line doc.Title conveys this meaning.)
like this you would do for all the matching documents. Better used in a loop. Finally you will get the HTML representation for entire documents that match the search query.
Finally show it in the specified form that you wish. You have two options here.
a. redirect the current window to show the search results. you will do it by using javscript code like "window.location=“http://server/database/$$resultsform?Openform” or self.location.href=“http://server/database/$$resultsform?Openform”
but on using this code the crucial point is to put the constructed HTML results in the window. It needs some googling to determine how to put the content in this window.
b. Use window.open method to open a new pop-up window, where you can show the results. This method is better than the first because you can write to this window using javascript “document.write” method.
you will use something like below in your agent:
print {}
'the above code will open a new pop-up window which will further open the specified form element(you can give your own design elements like form, view etc. for illustrational purposes, i have used $$resultsform here.)
'also by using mywindow.document.write(“text”); method, you can put the HTML content inside the newly opened window.
'The above method has one disadvantage, most browsers will block pop-up’s. so be sure to allow pop-up’s via your browser settings.
Hope that helps,
Jason