Customizing Presentation > Customizing Asset Advisor > Customizing the Asset List Filtering
Customizing the Asset List Filtering
The display of the asset list on the Asset Advisor main page can be customized. Services are provided for this purpose on the PTC.SCA.SCO.CustomActionHandler Thing:
AssetAdvisorPreFilter—Allows the implementation of custom JSON filters before any of the filter selections from the Asset Advisor Filter pane are processed for the asset list.
AssetAdvisorFilterActions—Applies the filter selections from the Asset Advisor Filter pane and the AssetAdvisorPreFilter service to the display of the asset list. Custom post-filter javascript or JSON can also be added.
Example—Automatically Filtering the Asset List by Asset Location
To automatically filter the asset list to display only assets with a certain Location value:
1. Navigate to the PTC.SCA.SCO.CustomActionHandler Thing.
2. Under Services, click Override service icon to override the AssetAdvisorPreFilter service.
3. In the service editor, edit the code to filter by a specific Location value. For example, the following code filters for only those assets with a Location value of Montreal:
var result = {"filters": [{"fieldName":"physicalLocation","type":"LIKE","value":"Montreal%"}]};
4. Click Done to apply the changes to the service.
5. Click Save to save the updates to the PTC.SCA.SCO.CustomActionHandler Thing.
No mashup customizations are necessary for this custom behavior to apply.
Example—Adding a New Filter to the Asset List Mashup
These services can also be used with updates to the Filters pane mashup to add a new filter to the user interface.
1. Navigate to the launch point configuration Thing (PTC.Factory.C_LaunchPointConfigurationThing_[ReleaseVersion]).
2. Under Configuration, in the LaunchPointEntitySettings section, edit the AssetListFilterMashup to point to the customizable duplicate asset list filter mashup (PTC.SCA.SCO.AssetMonitor.AssetList.C_FilterMashup_[ReleaseVersion]). Save the changes to the launch point configuration Thing.
3. Navigate to the PTC.SCA.SCO.AssetMonitor.AssetList.C_FilterMashup_[ReleaseVersion] mashup.
* 
When viewing or editing mashups that are provided with ThingWorx Apps, click No if presented with a message asking if you want to replace deprecated widgets with new widgets.
4. Add a new checkbox and input field for the new filter, following the implementation of the Model Number filter for the necessary bindings. Save the mashup.
5. Navigate to the PTC.SCA.SCO.CustomActionHandler Thing.
6. Under Services, click Override service icon to override the AssetAdvisorPreFilter service.
7. In the service editor, edit the code to include the new filter information. For example, if the new filter allows users to select from the list of Location values, the following code applies that filter:
var filter = [];
var currenJSONFilter = JSON.parse(currentFilter);
var isChecked = currenJSONFilter["isphysicalLocationChecked"];
var customValue = currenJSONFilter["physicalLocation"];
if ( isChecked ){
filter.push({"fieldName":"physicalLocation","type":"LIKE","value":customValue});
}
var result = {"filters": filter};
8. Click Done to apply the changes to the service.
9. Click Save to save the updates to the PTC.SCA.SCO.CustomActionHandler Thing.
Was this helpful?