Search Templates
Search templates are pre-defined SQL statements that can be applied to searches in the Exo Business system. Search templates can take in parameters such as a Debtor account number, so that they can return results specific to one record. Default search templates are installed with Exo Business, and expert users can write and insert new templates.
Adding Search Templates
You can create and edit search templates using the Exo Business Configurator, in the Business Admin > Search Templates section:
Note: The ability to create custom search templates is an advanced feature for expert users. In-depth knowledge of SQL and the Exo Business system is assumed. The Search Templates white paper on the Exo Business Education Centre contains detailed information on how to create SQL statements for search templates.
The Search Templates screen lists all existing templates. You can filter the list by type using the dropdown at the top of the screen.
Click New to create a new search template or double-click on an existing template to edit it. You can enter and edit the SQL statement that defines the search template on the SQL sub-tab:
Enter the SQL template that defines the search template into the SQL sub-tab. You can use the Parameters list dropdown to enter parameters into the statement.
You can use the Parameters list dropdown to enter parameters into the statement.
The Active check box lets you mark a template as active or inactive. Inactive templates are not available for selection on interfaces that support search templates.
The Preview sub-tab displays the results of a search using the entered SQL statement, while the Generated SQL sub-tab displays the SQL statement that will be generated from the query on the Query sub-tab—if any problems are detected with the query, this can be used to debug them.
The Availability sub-tab lets you control where and to whom each template will be available:
In the Available for Forms section, specify which Exo Business forms the search template will be available on, and whether or not it should be available via the Exo API. In the Available to Users, specify which users the template should be available to or tick the Available to All Users option.
Using Search Templates
Search templates can be used to filter searches:
- when selecting a stock item for a transaction line, e.g. on a Sales Order, Purchase Order or Debtor Invoice,
- when selecting a GL account or subaccount for a transaction,
- when selecting a company in Exo CRM.
Search windows contain a dropdown that displays all of the search templates that have been defined for those searches:
Selecting a search template immediately filters the search window according to the selected template. The currently selected template is displayed at the top of the window. The Filter button on the Stock Search and GL Search windows' toolbar can be used to toggle the filtering on and off.
Using Search Templates via the Exo API
Search templates are also accessible via the Exo API. A call to one of the following endpoints returns a list of available templates:
-
searchtemplate - lists all search templates in the system.
-
geolocationtemplate - lists only search templates for location-based searches on company accounts (TYPE = G).
-
stocksearchtemplate - lists only search templates for searches on stock items (TYPE = S).
-
companysearchtemplate - lists only search templates for searches on company accounts (TYPE = Y).
To use a search template to return search results, call the relevant endpoint with the ID number of the search template you want to use, e.g.
http://exo.api.myob.com/stocksearchtemplate/1
Depending on the search template being called, the call may need to pass parameters to filter the search results. Parameters are passed using standard HTTP query parameters, e.g.
http://exo.api.myob.com/searchtemplate/1?accno=21&q=airfil
This will return search results using the search template with the ID number 1, passing in the Debtor account number 21 and the search string “airfil” as parameters. Parameters can be passed in any order.
For more information, see the Exo API documentation at http://developer.myob.com/api/exo/.