system.kanoa.utilities.convertDatasetToBreadcrumb(dataset, pathColumn)
Converts an Ignition dataset into the nested items structure expected by the Breadcrumb component.
Each row's pathColumn value is split on \ into segments, and rows that share a path prefix share the same parent node,
so Site\Area A and Site\Area B both become children of a single Site node.
Each node has the following keys:
id String: A generated UUID, unique within the result. A new one is generated on every call, so don't store it.
label String: The node's path segment, e.g. Line 1 for Site\Area A\Line 1.
disabled Boolean: Always False.
collapsed Boolean: Always False.
data Dictionary: Every column of the row whose path is exactly this node's path. A node only implied by a longer path (e.g. Other when the dataset only has Other\Orphan) has an empty data dictionary.
children List: The child nodes, in the same format.
style Dictionary: Always empty.
Siblings are ordered by the dataset's sortOrder column if it has one (nodes without a sortOrder value come last, in dataset order). Otherwise they're ordered alphabetically by label, ignoring case. Rows with a null path are skipped, and if two rows have the same path, the node's data comes from the last one. Returns an empty list when dataset is None.
Parameters
dataset Dataset: Rows to convert, each with a backslash-delimited path
pathColumn String: Name of the column holding each row's path, e.g. assetPath for the dataset returned by system.kanoa.asset.getAssets
Returns
items List
Example
dataset = system.kanoa.asset.getAssets({'assetPath': 'Kanoa Industries%'})
items = system.kanoa.utilities.convertDatasetToBreadcrumb(dataset, 'assetPath')
# Assign to the Breadcrumb component
self.getSibling('Breadcrumb').props.items = items
# items will look like:
# [
# {
# "id": "3f1c9a2e-5b7d-4c1e-9a0f-2d8e6b4c7a11",
# "label": "Kanoa Industries",
# "disabled": False,
# "collapsed": False,
# "data": { "assetId": 9, "assetName": "Kanoa Industries", "assetPath": "Kanoa Industries", ... },
# "style": {},
# "children": [
# {
# "id": "a7d24f90-1e3b-4b8a-b6c5-0f9e8d7c6b52",
# "label": "Adelaide Hills",
# "disabled": False,
# "collapsed": False,
# "data": { "assetId": 10, "assetName": "Adelaide Hills", "assetPath": "Kanoa Industries\\Adelaide Hills", ... },
# "style": {},
# "children": [
# {
# "id": "c58e0b13-7f6a-4d29-8e41-6a3b2c1d0e94",
# "label": "Line 1",
# "disabled": False,
# "collapsed": False,
# "data": { "assetId": 101, "assetName": "Line 1", "assetPath": "Kanoa Industries\\Adelaide Hills\\Line 1", ... },
# "style": {},
# "children": []
# }
# ]
# }
# ]
# }
# ]