system.kanoa.utilities.convertDatasetToBreadcrumb(dataset)
Converts an Ignition dataset into the nested node structure expected by the Breadcrumb component. The dataset's assetPath column is used to derive the parent-child hierarchy. Each row becomes a BreadcrumbNode with assetId mapped to id, assetName mapped to label, and all remaining columns packed into the node's data object.
Parameters
dataset Dataset: The dataset to convert. Must contain at minimum the following columns:
assetId Integer: Mapped to the node's id field.
assetName String: Mapped to the node's label field.
assetPath String: Used to determine hierarchy. Path segments are separated by \ (e.g. Kanoa Industries\Adelaide Hills\Line 1).
All other columns are included in the node's data object and will be returned by the Breadcrumb component's onPathChange event.
Returns
items List: A list of top-level BreadcrumbNode objects with nested children, ready to be assigned directly to the Breadcrumb component's items property.
Example
dataset = system.kanoa.asset.getAssets({'assetTypeName': 'line'})
items = system.kanoa.utilities.convertDatasetToBreadcrumb(dataset)
# Assign to the Breadcrumb component
self.getSibling('Breadcrumb').props.items = items
# items will look like:
# [
# {
# "id": 9,
# "label": "Kanoa Industries",
# "data": { "assetId": 9, "assetName": "Kanoa Industries", ... },
# "children": [
# {
# "id": 10,
# "label": "Adelaide Hills",
# "data": { "assetId": 10, "assetName": "Adelaide Hills", ... },
# "children": [
# {
# "id": 101,
# "label": "Line 1",
# "data": { "assetId": 101, "assetName": "Line 1", ... },
# "children": []
# }
# ]
# }
# ]
# }
# ]