Searching for input and output assets
By default, only devices and device groups are shown in the palette (see also
Adding a block). However, when you use the search boxes that are available for the input and output blocks, all assets (not only the devices and device groups) in the
Cumulocity IoT inventory which match the search criteria are shown. You can thus build analytic models by defining any assets in the inventory as input blocks or output blocks.
If you want to restrict the search to show only assets of a specific type (for example, to show only devices), you need to change the tenant options. That is, you need to send a
POST /tenant/options request. For detailed information, see the information on tenants in the
Reference guide at
https://www.cumulocity.com/guides/.
For example, specify the following if you only want to show devices:
{
"category": "analytics.builder",
"key": "c8yAnalyticsBlocks.queryInventoryNameSearchAdditionalFilter",
"value": "has(c8y_IsDevice)"
}
The c8y_IsDevice in the value is a so-called fragment. You can specify any fragment that is known to Cumulocity IoT, including any fragments that you have created yourself.
You can combine several values. For example, specify the following if you only want to show devices and device groups:
{
"category": "analytics.builder",
"key": "c8yAnalyticsBlocks.queryInventoryNameSearchAdditionalFilter",
"value": "has(c8y_IsDevice) or has(c8y_IsDeviceGroup)"
}
The default value of this tenant option is not has(c8y_IsVirtualDevice). As long as you do not change this tenant option, virtual devices are not shown as they would not make sense in an analytic model. If you change the value for this tenant option, make sure to specify all assets that you want to see in the search result.
The tenant options are also used in the block parameter editor when you select a different device (see
Editing the parameters of a block) and when you replace devices (see
Replacing devices, device groups and assets).