Adapt Query Field in Search ($$Search) Form for Specific Field Level Searches

Author: Tripp W Black

Created: 03/26/2003 at 03:06 PM

 

Category:
Notes Developer Tips
Fields, Forms/Subforms

This document is a support reference document for customizing a $$Search form so that you can search for specific field values. This document assumes you have a search form based on the $$Search form template. You can get this form out of a multi-database search template among others.


Create fields above the "Query" field to hold your field names and values. To keep it simple, name the fields the same as the fields in the documents you are retrieving. Layout the fields with labels in a suitable template.

Change the query to computed and use the formula code below as a template:

Example fieldnames:
Customer
PONo
OrdNo
InvNo
CustID
CustType
City
ZIP

tmp1:=@If(Customer !=""; "FIELD+Customer=" + Customer; "");
tmp2:=@If(PONo !=""; "FIELD+PONo=" + PONo; "");
tmp3:=@If(ORDNO !=""; "FIELD+ORDNO=" + ORDNO; "");
tmp4:=@If(InvNo !=""; "FIELD+InvNo=" + InvNo; "");
tmp5:=@If(CustID !=""; "FIELD+CustID=" + CustID; "");
tmp6:=@If(CustType !=""; "FIELD+CustType=" + CustType; "");
tmp7:=@If(City !=""; "FIELD+City=" + City; "");
tmp8:=@If(ZIP !=""; "FIELD+ZIP=" + ZIP; "");
tmpa:=@Trim(tmp1 : tmp2 : tmp3 : tmp4 : tmp5 : tmp6 : tmp7 : tmp8);
tmpb:=@Implode(tmpa; "+AND+");
tmpb

Lastly, make sure the submit button does the commands filesave and fileclosewindow, and make sure that the $$Return is using the view you want and constructing URL correctly based on Query and the other optional search paramters.

previous page