ThingWorx Analytics Data > Handling Dataset Filters via ThingWorx Analytics DataThing
Handling Dataset Filters via ThingWorx Analytics DataThing
Beginning in Analytics Server 9.3, dataset filters are stored with their corresponding datasets within ThingWorx Analytics. Services have been added in the Data microservice to facilitate creating, retrieving, or deleting filters for a specific dataset. Analytics Builder has also been updated to access dataset filters via these services. This topic describes how to use these services to create, retrieve, or delete dataset filters.
To access the filter services, navigate to the DataThing Services tab. Expand the sections below for more information about using each filter service.
CreateFilter 
Use this service to create a new filter for a specific dataset.
1. In ThingWorx Composer, navigate to the Things page.
2. Find the DataThing in the list of Things and click to open it. The General Information page is displayed.
* 
The DataThing name will be prefixed with the server name you assigned during the ThingWorx Analytics Server installation process.
3. At the top of the screen, select the Services tab.
4. Scroll through the services to find CreateFilter and click to open it.
5. In the datasetID field, enter the dataset URI in the following format:
dataset:/dbbba6b6-a713-4b0c-a331-511b3d7f4b79
You can copy this URI from the Datasets list page of Analytics Builder. Make sure you include the dataset:/ prefix when you enter the value in the datasetID field of the filter service.
6. In the name field, enter a name for the filter you are creating.
7. In the filterAsSql field, enter a valid SQL where clause to define the filter criteria.
* 
Example:
((`Grinder Type` = 'Integrated'))
8. Click Execute. The new filter is created. The Output panel displays No results but you can use either the GetFilter or GetFilters service to ensure that the new filter has been created.
GetFilter 
Use this service to view information about a specific filter associated with a dataset.
1. In ThingWorx Composer, navigate to the Things page.
2. Find the DataThing in the list of Things and click to open it. The General Information page is displayed.
* 
The DataThing name will be prefixed with the server name you assigned during the ThingWorx Analytics Server installation process.
3. At the top of the screen, select the Services tab.
4. Scroll through the services to find GetFilter and click to open it.
5. In the datasetID field, enter the dataset URI in the following format:
dataset:/dbbba6b6-a713-4b0c-a331-511b3d7f4b79
You can copy this URI from the Datasets list page of Analytics Builder. Make sure you include the dataset:/ prefix when you enter the value in the datasetID field of the filter service.
6. In the name field, enter the name of an existing filter associated with the dataset.
7. Click Execute. The Output panel displays the following information about the specified filter:
datasetID – The URI of the dataset.
name – The name of the filter.
filterAsSql – The SQL definition of the filter.
GetFilters 
Use this service to view a list of all the filters associated with a specific dataset.
1. In ThingWorx Composer, navigate to the Things page.
2. Find the DataThing in the list of Things and click to open it. The General Information page is displayed.
* 
The DataThing name will be prefixed with the server name you assigned during the ThingWorx Analytics Server installation process.
3. At the top of the screen, select the Services tab.
4. Scroll through the services to find GetFilters and click to open it.
5. In the datasetID field, enter the dataset URI in the following format:
dataset:/dbbba6b6-a713-4b0c-a331-511b3d7f4b79
You can copy this URI from the Datasets list page of Analytics Builder. Make sure you include the dataset:/ prefix when you enter the value in the datasetID field of the filter service.
6. Click Execute. The Output panel displays the number of filters associated with the dataset.
7. In the Output panel, click in the filters table to view a list of the dataset filters. Each filter is listed with the following information:
datasetID – The URI of the dataset.
name – The name of the filter.
filterAsSql – The SQL definition of the filter.
DeleteFilter 
Use this service to delete a specific dataset filter by the filter name.
1. In ThingWorx Composer, navigate to the Things page.
2. Find the DataThing in the list of Things and click to open it. The General Information page is displayed.
* 
The DataThing name will be prefixed with the server name you assigned during the ThingWorx Analytics Server installation process.
3. At the top of the screen, select the Services tab.
4. Scroll through the services to find DeleteFilter and click to open it.
5. In the datasetID field, enter the dataset URI in the following format:
dataset:/dbbba6b6-a713-4b0c-a331-511b3d7f4b79
You can copy this URI from the Datasets list page of Analytics Builder. Make sure you include the dataset:/ prefix when you enter the value in the datasetID field of the filter service.
6. In the name field, enter the name of an existing filter associated with the dataset.
7. Click Execute. The specified filter is deleted from the dataset.
The Output panel displays No results.
DeleteFilters 
Use this service delete all of the filters associated with a specific dataset
1. In ThingWorx Composer, navigate to the Things page.
2. Find the DataThing in the list of Things and click to open it. The General Information page is displayed.
* 
The DataThing name will be prefixed with the server name you assigned during the ThingWorx Analytics Server installation process.
3. At the top of the screen, select the Services tab.
4. Scroll through the services to find DeleteFilters and click to open it.
5. In the datasetID field, enter the dataset URI in the following format:
dataset:/dbbba6b6-a713-4b0c-a331-511b3d7f4b79
You can copy this URI from the Datasets list page of Analytics Builder. Make sure you include the dataset:/ prefix when you enter the value in the datasetID field of the filter service.
6. Click Execute. All of the existing filters are deleted from the dataset (except for all_data).
The Output panel displays No results.
Was this helpful?