Multi Value Listbox in Search on web

Hi,

I have a couple of issues regarding searching using a browser.

What we have is a customised Search form where the user selects the And/OR option, then selects values from 3 multi value list boxes, 8 text fields, date options for everything on/before/from a date or between two dates and then which view to search and the order to display the search results in.

The search works really well except when choosing multiple values from any of the top 3 list boxes.

For example, when selecting two options from the first list box (Act), the url that results is like:

http://server/database.nsf/view?SearchView&Query=[Act]=“Option One”&SearchOrder=4&Count=100,/database/view?SearchView&Query=[Act]=“Option Two”&SearchOrder=4&Count=100. It shows only those records which match the 2nd option selected

If I edit this to:

http://server/databasensf/view?SearchView&Query=[Act]=“Option One” OR [Act]=“Option Two”&SearchOrder=4&Count=100, the search works and the correct results are shown.

The search results are derived from a formula (written in formula language) in the $$Return field. I’ve added the formula in below in case that gives anyone an idea.

The other issue is with the next and previous buttons when used with search results. I checked the template used on this forum and get exactly the same results as I experience in my app.

Once a document is opened from the search results, Next and Previous are going to the relevant documents with the view that the results are derived from. In my case, the view varies depending on options selected in the search and the next and previous all work relative to the searched view.

I have noticed the URL changes from being …?SearchView&Query=… to being the …viewunid/docunid?opendocument.

Is there a way of passing that search query to the document when its opened from the search results? The Next and Previous buttons are also used when the documents are opened from other views in the database and so I need to make sure that anything I change isn’t going to impact on that functionality.

$$Return field formula - it looks extremely complicated but it has covered every option our people have come up with so far:

REM {If nothing to search for return to search form!};

REM {@If(@Trim(Query)=“”&@Trim(SearchQuery)=“”; @Return(“[/”+@WebDbName + “/WSAdvanced]”);“”);};

@If(Act=“None”;@ReplaceSubstring(Act;“None”;“”);Act);

@If(Regulations=“None”;@ReplaceSubstring(Regulations;“None”;“”);Regulations);

@If(Position=“None”;@ReplaceSubstring(Position;“None”;“”);Position);

@If((Act=“None” | Act=“” )& (Regulations =“None” | Regulations=“”) & (Position =“None” | Position = “”) & Word1=“” & Word2=“” & Word3=“” & Word4=“” & Word5=“” & Word6=“” & Word7=“” & Word8=“” & QueryDate=“” & AfterDate=“” & BeforeDate=“”; @Return(“[/”+@WebDbName+“/WSAdvanced2]”);@Success);

REM {Build the search};

x:=@If(SearchLookFor=“1”;" AND “;SearchLookFor=“2”;” OR “;”");

words8:=@If(Word1!=“”;Word1;“”);

words7:=@If(words8!=“” & Word2!=“”; words8 + x + Word2; words8=“” & Word2!=“”; Word2; Word2=“” & words8!=“”; words8;“”);

words6:=@If(words7!=“” & Word3!=“”; words7 + x + Word3; words7=“” & Word3!=“”; Word3; Word3=“” & words7!=“”; words7;“”);

words5:=@If(words6!=“” & Word4!=“”; words6 + x + Word4; words6=“” & Word4!=“”; Word4; Word4=“” & words6!=“”; words6;“”);

words4:=@If(words5!=“” & Word5!=“”; words5 + x + Word5; words5=“” & Word5!=“”; Word5; Word5=“” & words5!=“”; words5;“”);

words3:=@If(words4!=“” & Word6!=“”; words4 + x + Word6; words4=“” & Word6!=“”; Word6; Word6=“” & words4!=“”; words4;“”);

words2:=@If(words3!=“” & Word7!=“”; words3 + x + Word7; words3=“” & Word7!=“”; Word7; Word7=“” & words3!=“” ; words3;“”);

words:=@If(words2!=“” & Word8!=“”; words2 + x + Word8; words2=“” & Word8!=“”; Word8; Word8=“” & words2!=“”; words2;“”);

date:=@If(QueryDate!=“” & CreateModify!=“” & BeforeAfter!=“”; CreateModify + BeforeAfter + QueryDate;“”);

daterange:=@If(DateChoice!=“” & AfterDate!=“” & BeforeDate!=“”; DateChoice + “>=”+ AfterDate +" AND " + DateChoice + “<=” + BeforeDate ;“”);

searchfor1:=@If((Act!=“” & Act !=“None”) & (Position!=“” & Position!=“None”);“[Act]="” + Act +“"” + x + “[Position]="”+Position+“"”; ((Act=“” | Act =“None”) & (Position!=“” & Position!=“None”));“[Position]="”+Position+“"”; ((Position=“” | Position =“None”) & (Act!=“” & Act !=“None”)) ;“[Act]="”+ Act +“"”; “”);

searchfor2:=@If((searchfor1!=“” & searchfor1!=“None” ) & (Regulations!=“” & Regulations!=“None” ); searchfor1 + x + “[Regulation]="”+Regulations+“"”; ((searchfor1=“” | searchfor1=“None” ) & (Regulations!=“” & Regulations!=“None” )); “[Regulation]="”+Regulations + “"”; ((Regulations=“” | Regulations=“None”)&(searchfor1!=“” & searchfor1!=“None” )); searchfor1;“”);

searchfor3:=@If((searchfor2!=“” & searchfor2!=“None”) & words!=“”; searchfor2 + x + words; ((searchfor2=“” | searchfor2=“None”) & words!=“” ); words; (words=“” & (searchfor2!=“” & searchfor2!=“None”) ); searchfor2;“”);

searchfor4:=@If(searchfor3!=“” & date!=“”;searchfor3 + x + date; (searchfor3=“” & date!=“” ); date; (date=“” & searchfor3!=“”) ; searchfor3;“”);

searchfor:=@If(searchfor4!=“” & daterange!=“”; searchfor4 + x + daterange; (searchfor4=“” & daterange!=“”) ; daterange; (daterange=“” & searchfor4!=“” ); searchfor4;“”);

};

options:=@If(QuickSearch=“1”; “”;

@If( SearchMaxResults=“0”; “”; “&SearchMax=” + SearchMaxResults )

);

“[/”+@WebDbName + “/”+FormType+“?SearchView&Query=” + searchfor + “&SearchOrder=4&Count=100” +Options + “]”

Any suggestions gratefully received.

TIA

Lisa

Subject: Multi Value Listbox in Search on web

Hi,

I did not read all your post… but for your question :

“Is there a way of passing that search query to the document when its opened from the search results?”

You can use a CGI variable Query_String_Decoded (In fact a Notes field called “Query_String_Decoded”) to get the search query in document (look Designer Help for more infos…)

or

you can use a Profile document to store search URL and get it (LotusScript or @ formula), it’s a little more complicated to make… (look Designer Help for more infos…)

HTH

Thierry