JetkeySmartMap Send comments on this topic.
Using the Search Box for Custom Searches

Glossary Item Box

You can activate Smart Map's search box to perform custom searches on your own data for plotting points on a map.  If the custom search fails to yield results, a Google search is then attempted. 

Abstract

Create a custom query in Query Manager and insert the {query} parameter into your WHERE clause.  (This parameter passes the contents of Smart Map's search box into your WHERE clause.) 

Next, enter the QID of your new query into the Search QID field of the Smart Map Settings and click update

That's all there to it!  From now on Smart Map will execute your custom search when using either the search box or passing a query through the querystring using the q parameter.

Example

  1. Open Query Manager and type of paste the following query into the Query box. Complete the form as shown in the image below and click Update.

    SELECT Country, Latitude, Longitude
    FROM JetkeyCountry
    WHERE Country LIKE '{query}%'
    AND Latitude IS NOT NULL

    Search Box Example
    EnlargeClick to enlarge
  2. After saving the query, scroll to the top of the page and jot down the QID that was assigned to the new query.
  3. Open Smart Map's Settings.  Input the QID into the Search QID field and click Update. (In my case, the QID is 5).  This wires the search box to our custom query.
    Search QID
    EnlargeClick to enlarge

     This also causes any "q=" parameter passing through the querystring to automatically fire this custom query.  See Querystring Example below.
 

Try it

Now that we have wired the search box to our custom query, any search done through the search box will fire our custom query first.  If no results are found, a Google search is then performed.

To list all countries that begin with the letter "B", type the letter B into the search box and hit the Enter key, or else click the Search button.

Search Box Example
EnlargeClick to enlarge
 

Querystring Example

We can also fire our custom query through the querystring:

http://smartmap.jetkey.com/Example/tabid/54/Default.aspx?q=b