Appendix: Using the DATASOURCE Element Tag
The DATASOURCE element tag generates a string of JSON-formatted values based on the result of a data source query, then assigns that string to a keyword. If the query fails - for example, because the specified data source or filter does not exist - the element will return a value of False.
This tag has the following default syntax:
<%# DATASOURCE(
Keyword
Datasource
Model
Filter
Refresh) %>
The following parameters are required:
Parameter | Description |
---|---|
Keyword | A string containing the name of the keyword you want to hold the resulting JSON data. |
Datasource | A string containing the name of a data source you intend to query. |
The following parameter is only required if the element is rendered outside the model associated with the chosen data source - for example, if it is called by a different model, or as part of a web page's markup:
Parameter | Description |
---|---|
Model | A string containing the model reference associated with the chosen data source. |
The following parameters are optional:
Parameter | Description |
---|---|
Filter | A string containing the name of a filter associated with the chosen data source. Only data that satisfies this filter will be returned by the query. If this argument is omitted or set to an empty string, the query will return all values in the data source. |
Refresh | A Boolean value that determines whether the element will refresh the data source before executing a query. If this argument is omitted or set to an empty string, the parameter will use a value of 0 by default. |