To run the operations on the data set, you must create instance of the data set.
The following table specifies the functions to create an instance of a data set.
|
Function |
Use |
|---|---|
|
DataSet.getInstance(String datasetName) |
Retrieves the data set and does not inherit the request parameter. |
|
DataSet.getInstance(String datasetName, boolean copyProperties) |
Retrieves the data set and inherit the request parameter. |
The following table specifies the functions to run the operations for the above-created instance.
|
Function |
Use |
|---|---|
|
<ds_param>.addParameter(String name, Object value) |
Adds a new parameter value to the data set. |
|
<ds_param>.setParameter(String name, Object value) |
Sets the value of the currently defined parameter. |
|
<ds_param>.getParameter(String name) |
Retrieves the value of the parameter. |
|
<ds_param>.cache(String tableName) |
Executes the data set and save the result to a specific cache table. |
|
<ds_param>.saveToCache(String tableName) |
Executes the data set and save the result to a specific cache table. |
|
<ds_param>.getColumnData(String fieldName) |
Retrieve the list of values from the data set for a specific field. |
|
<ds_param>.getData() |
Retrieves the JSON result of the data set. |
|
<ds_param>.getFirst(String fieldName) |
Retrieves the first values of the data set for a specific field. |
|
<ds_param>.getQueryParameters() |
Allows manipulation of the query parameters that are bound to the data set. |
|
<ds_param>.getRawData() |
Retrieves the entire data set result as a List<Map> object. |
|
<ds_param>.respond() |
Sets the response of the request to the result of the data set. |
|
<ds_param>.setCacheName(String cacheName) |
Sets the name of the cache used for creating temporary tables of results. |
|
<ds_param>.getCacheName() |
Retrieves the cache table name. |
|
<ds_param>.setEscapeHtml(boolean escapeHtml) |
Sets the flag for whether or not any HTML in the result should be escaped or not. |
The following table specifies the functions to execute a query, set the flag, and throw an error message.
|
Function |
Use |
|---|---|
|
provider.execute(String query) |
Executes a query against the H2 cache and sets the results of the request to it. |
|
provider.query(String query) |
Executes a query against the H2 cache and sets the results of the request to it. |
|
provider.setIncludeAdminColumns(boolean includeAdminColumns) |
Sets the flag of whether or not system columns should be present in the result. |
|
provider.throwError(String message) |
Informs the script to throw an error with a message. |