Provide more search operators

Chong-ho (Alex) Yu, Ph.D., MCSE, CNE

Problem:

On the Web the user should be able to search records by name. However, the user may not remember the exact name. But if I use "contain operator" rather than "equal operator," many irrelevant records may be returned in the search result.

Further, in a payroll database the user should be able to search the records by pay rate. Again, the user may not remember the exact pay rate. It would be easier for the user to include a broader range of search criterion in the query such as "give me the record when the pay rate is greater than or equal to ten dollars per hour.

Solution:

You can create a popup list for the user to choose a convenient search operator. For the name search insert the following line before the input text field for the search value.


		<SELECT NAME="-op" SIZE=1>
				<OPTION value="eq">equals to
				<OPTION value="neq">not equals to
				<OPTION value="cn">contains
				<OPTION value="bw">starts with
				<OPTION value="ew">ends with
		 </SELECT>

The above tags create the following search operator options:

Last Name:
No doubt these search operator options could make the query more efficient. For instance, if you are not sure the name is "Alan" or "Alex", you can choose "starts with" as the operator and enter "Al" as search value. The search engine will return all records with a name starting with "Al".

For pay rate insert the following tags before the input text field for the search value:


			<SELECT NAME="-op" SIZE=1>
				<OPTION value="eq">=
				<OPTION value="gt">>
				<OPTION value="lt"><
				<OPTION value="gte">=>
				<OPTION value="lte"><=
				<OPTION value="neq"><>
		      	</SELECT>

The preceding tags create the following search operator options:

Pay Rate:

Again, the above numeric search operators provide more freedom for the user.


Navigation

FMP Tips Contents

Other computer tips

Search Engine

Credit/Copyright ©

Simplified Navigation

Table of Contents

Contact Me