--- title: "system.secsgem.toTreeDataset" description: "Changes an existing dataset, as returned by the system.secsgem.toDataSet function, to make it usable for the Tree View component." --- # system.secsgem.toTreeDataset > Changes an existing dataset, as returned by the system.secsgem.toDataSet function, to make it usable for the Tree View component. This function is used in **Python Scripting**. ## Description Changes an existing dataset, as returned by the [system.secsgem.toDataSet](appendix\scripting-functions\system-secsgem\system-secsgem-toDataset.md) function, to make it usable for the [Tree View](appendix\components\vision-components\tables\tree-view\tree-view.md) component. ## Client Permission Restrictions This scripting function has no [Client Permission](../../../ignition-modules/vision/vision-project-properties/vision-project-properties.md#vision-permissions-properties) restrictions. ## Syntax `system.secsgem.toTreeDataset(dataset)` ### Parameters | Type | Parameter | Description | | ------- | ------- | ------ | | Dataset | `dataset` | A DataSet containing a SECS message. Note that this parameter cannot take a JSON message, so the object returned by [system.secsgem.getResponse](appendix\scripting-functions\system-secsgem\system-secsgem-getResponse.md) must first be processed by [system.secsgem.toDataSet](appendix\scripting-functions\system-secsgem\system-secsgem-toDataset.md). | ### Returns **Dataset** - A dataset containing a SECS message with the following columns, as suited for Vision's tree view component: "path", "text", "icon", "background", "foreground", "tooltip", "border", "selectedText", "selectedIcon", "selectedBackground", "selectedForeground", "selectedTooltip", "selectedBorder" ### Scope Gateway, Vision Client, Perspective Session ## Code Example ```python title="Code Snippet" # Assuming the variable named "message" contains a SECS message, we will first convert it to a Dataset. dataset = system.secsgem.toDataset(message) # The initial dataset generated by toDataSet will not work with the Tree View component, so we'll modify it... dataset = system.secsgem.toTreeDataset(dataset) # ...and now pass the dataset into the Tree View component's data property. event.source.parent.getComponent('Tree View').data = dataset ```