system.secsgem.toDataset
This function is used in Python Scripting.
Description
Converts a SECS message data structure, as returned by the system.secsgem.getResponse function, into a dataset and returns it.
Client Permission Restrictions
This scripting function has no Client Permission 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 page. |
Returns
DataSet - A DataSet representing a SECS message.
Scope
Gateway, Designer, Client
Code Examples
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
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
}
]
}