--- 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\tables\tree-view\tree-view.md) component. ## Client Permission Restrictions This scripting function has no [Client Permission](projects\project-properties\project-properties.md#client---permissions) 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 that can be used in the Tree View component. ### Scope Gateway, Designer, Client ## Code Examples ```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 ```