Manage Learn to apply best practices and optimize your operations.

Web Search View By Typing In First Few Letters Of Search

This is a way to mimic the Notes Client functionality of typing in the first few chacters of the keyword on the document you are looking for and having the view position itself to start at the first document matching the entered value (or immediately following it if there is no match). This uses both HTML and JavaScript. I use this on the $$ViewTemplate form.
On the $$ViewTemplate form:

1. Create the following 2 hidden fields:
Field Name: ViewTitle (Text, Computed)
Field Value:
@ReplaceSubstring(@Subset(@ViewTitle; 1); " "; "+")

Field Name: ViewPath (Text, Computed)
Field Value:
"/" + @ReplaceSubstring(@ReplaceSubstring(@Subset(@DbName; -1); ""; "/");" "; "+")

2. Create an editable text field and a "Go!" button using passthru HTML as follows:

<INPUT NAME='getVal' VALUE='' Size=20> <INPUT TYPE=button onClick="var Val=document.forms[0].getVal.value;
ViewStart(Val)" VALUE="Go!">

I place this code above the $$ViewBody field

You can also add the text: "Enter the first few characters of the Account Name (or Employee Name, or Account Number...whatever) just prior to the above. Don't do this in passthru HTML (it still works but looks ugly unless you specify the ...etc. If you use Notes to select the Font size & color it's easier to read and change)


3. In the JS Header create the following function:

function ViewStart(StartVal){

var viewtitle = document.forms[0].ViewTitle.value;
var viewpath = document.forms[0].ViewPath.value;
location= viewpath + "/" + viewtitle +"?OpenView&StartKey=" + StartVal+ "&Count=50&ExpandView";}

That's it.

Optional extra:

If you are allowing the user to switch between views, this will work for whichever view you are using. Change the text prior to the input field by creating a computed for display field based on the current view so that for a view by Employee Name the text would say "Enter the first few characters of the Employee Name " and if the view sorted by Department (or Employee ID... well you get my drift)

Field Name: Searchtext (Text, Computed for Display)
Field Value:
v := @ReplaceSubstring(@Subset(@ViewTitle; 1); " "; "+");
@If(@Contains(v;"Name");"Enter the first few characters of the Employee Name";@Contains(v;"ID");"Enter the first few characters of the Employee ID";"Enter Search Value")
v := @ReplaceSubstring(@Subset(@ViewTitle; 1); " "; "+");
@If(@Contains(v;"Name");"Enter the first few characters of the Unit Name";@Contains(v;"Number");"Enter the first few characters of the Unit Number";"Enter Search Value")

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

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

SearchDataCenter

SearchContentManagement

Close