How to Create Auto-Query Links

eCriteria Premium and Enterprise accounts include the Auto Query feature that makes it possible to attach a pre-configured database query to a text or graphic image hyperlink. When the user clicks on the link, the query is automatically sent to eCriteria, and search results returned for viewing. This technique eliminates the need to first present the typical search criteria form page to the user. With eCriteria's Auto Query feature, you can provide a convenient way for website users to retrieve data quickly.

As an example use of the Auto Query feature, you can display a graphic image representing a particular product category such as "Office Supplies". If the user clicks on the image, a pre-configured eCriteria database query will retrieve and display only product items in the office supplies catagory. This way, you don't have to present a search criteria form containing a pull-down list of categories (although you may wish to include this option as well).

Using the Auto Query feature is simple, requiring only a little Javascript code, and a special eCriteria page called LinkAutoQuerySearchResult.asp. We'll demonstrate how to configure eCriteria to do auto queries below. Note: the HTML code below is a sample only. You'll have to customize it to suite your requirements.

Step 1 Begin by creating a new eCriteria database in the usual way. Be sure to specify the search fields for the database, as you'll need them for the Auto Query. In the sample implementation below, the search fields are "City" and "TickerSymbol", both Text datatypes.
Step 2 Create a Web page similar to the sample autoquery.htm below using your favorite HTML editor and place it on your site's Web server. Click here to experiment with the Auto Query sample page: Auto Query Sample Page.
Step 3 The HTML appearing in bold represents database specific items that you would replace with your own. The sample is configured to query on two different fields, "City" and "TickerSymbol". If you only needed to query on one field, then you'd remove one. Similarly, you'd replace the query field values with your own, e.g. "Los Angeles" is a field value.

<html>
<head>
<title>autoquery.htm</title>
<script language="javascript">
function Search( obj, myVal) {
   obj.value = myVal;
   document.form1.submit();
}
function ClearValues() {
   document.forms(0).T_e_City.value = '';
   document.forms(0).T_e_TickerSymbol.value = '';
}
</script>
</head>

<body onload="ClearValues();">
   Database: LAPubCompanies
<form method=post action="www.eCriteria.net/LinkAutoQuerySearchResult.asp?DBName=LAPubCompanies" name=form1>

<li><a href="javascript:Search(document.form1.T_e_City, 'Los Angeles');">City:
Los Angeles</a></li>
<li><a href="javascript:Search(document.form1.T_e_City, 'Burbank');">City: Burbank</a></li>
<li><a href="javascript:Search(document.form1.T_e_TickerSymbol, 'GES');">Ticker Symbol: GES</a></li>

<input type=hidden name=T_e_City value="">
<input type=hidden name=T_e_TickerSymbol value="">

</form>
</body>
</html>
 
 

Copyright ©1994-2005 AMULET Development Corp. All rights reserved.