--- title: "system.secsgem.toDataset" description: "Converts a SECS message data structure, as returned by the system.secsgem.getResponse function, into a dataset and returns it." --- # system.secsgem.toDataset > Converts a SECS message data structure, as returned by the system.secsgem.getResponse function, into a dataset and returns it. This function is used in **Python Scripting**. ## Description Converts a SECS message data structure, as returned by the [system.secsgem.getResponse](system-secsgem-getResponse.md) function, into a dataset and returns it. ## 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.toDataset(secsObject)` ### Parameters | Type | Parameter | Description | | ------- | ------- | ------ | | Any | `secsObject` | A Python object, such as Sequence or a Dictionary, representing a SECS message to convert to a dataset. More information on how to format the Python object can be found on the [SECS Definition Language (SDL) File](ignition-modules/secs-gem/secs-definition-language-sdl-file.md) page. | ### Returns **DataSet** - A Dataset representing a SECS message. ## Scope Gateway, Vision Client, Perspective Session ## Code Examples ```python title="Code Snippet" # Receive a SECS message. object = system.secsgem.getResponse(transactionID, "myEquipment", 2) # Turn the message into a dataset. dataset = system.secsgem.toDataSet(object) # Assuming this script was called from a component script, and a Table component was in the same container as the component that called this script, we could pass # the dataset to the Data property. event.source.parent.getComponent('Table').data = dataset ``` ```python title="Code Snippet - Manually Making the Message" { "header":{ "doc":"nonexistent function", "stream":100, "function":100, "reply":"False" }, "body":[ { "doc":"FirstItem, my first nonsense item", "format":"U4", "value":1234 }, { "doc":"SecondItem, the other nonsense item", "format":"U4", "value":5678 } ] } ```