Search Templates
Search templates are pre-defined SQL statements that you can apply to searches in Exo Business. Search templates can use parameters such as a Debtor account number and return results specific to one record. Default search templates are installed with Exo Business.
Adding Search Templates
You can create and edit search templates in Exo Business Configurator under Business Admin > Search Templates:
Note: Creating custom search templates is an advanced feature for expert users and you need in-depth knowledge of SQL and Exo Business. The Search Templates white paper contains detailed information on how to create SQL statements for search templates.
The Search Templates screen lists all templates. You can filter the list by type using the dropdown at the top of the screen.
Click New to create a search template or double click a 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 Query sub-tab. You can use the Parameter List dropdown menu to add parameters to the statement.
Click the Active checkbox to mark a template as active or inactive. You can't select inactive templates on interfaces that support search templates.
The Preview sub-tab displays the results of a search using the entered SQL statement. The Generated SQL sub-tab displays the SQL statement that is generated from the query on the Query sub-tab. If there are problems with the query, use the Generated SQL sub-tab to debug them.
Use the Availability sub-tab to control where and to whom each template is available:
In the Available for Forms section, specify on which forms the search template are available, and whether or not it should be available via the Exo API. In the Available to Users section, specify the users to whom the template is available or click the Available to All Users option.
Using Search Templates
Use search templates to filter searches when selecting:
- A stock item for a transaction line — for example, on a Sales Order, Purchase Order or Debtor Invoice,
- A GL account or subaccount for a transaction,
- A company in Exo CRM.
Search windows contain a dropdown that displays all of the search templates defined for those searches:
Selecting a search template filters the search window using the template. The template displays at the top of the window. Click the Filter button on the Stock Search and GL Search windows to toggle the filtering on and off.
Using Search Templates via the Exo API
You can also access search templates using he Exo API. A call to one of these endpoints returns a list of available templates:
-
searchtemplate - lists all search templates in Exo Business.
-
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 endpoint with the ID number of the search template to use — for example,
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 HTTP query parameters — for example,
http://exo.api.myob.com/searchtemplate/1?accno=21&q=airfil
This returns 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. You can pass parameters in any order.
For more information, see the Exo API documentation.