I've been struggling for a few days with a problem that started when I tried to convert a dataset to a pydataset.
I have a dataset that is generated by a named query on a custom component.
On this component, I have no trouble calling toPyDataset
On a separate custom property, I grab the type of this dataset, and print it out.
I then pass the dataset to a secondary component as a parameter. (My primary is a Map, the secondary is a view that's tied in with the customControl ~'embedded view'~ prop of the Map, if you're curious)
this secondary view gets this lovely data passed as a parameter.
On a separate custom property on the view, I grab the type of this dataset parameter, and print it out.
Lastly, I have a message handler which reacts to a different set of changing data. My ultimate goal is to be able to read data out of the secondary view's dataset parameter and print out data.
Inside of the message handler script I grab the type of this dataset from the secondary view, and print it out.
And here's the fantastic result of all three of these print statements, once I navigate to this page!
Primary : <type 'com.inductiveautomation.ignition.common.JsonDataset'>
Primary : <type 'com.inductiveautomation.ignition.gateway.datasource.BasicStreamingDataset'>
Secondary: <type 'com.inductiveautomation.ignition.common.JsonDataset'>
Secondary: <type 'com.inductiveautomation.perspective.gateway.script.JsonifiableArrayList'>
in Message Handler: <type 'com.inductiveautomation.perspective.gateway.script.PropertyTreeScriptWrapper$ArrayWrapper'>
Isn't that grand! three different dataset types. BasicStreamingDataset, JsonifiableArrayList, and. PropertyTreeScriptWrapper$ArrayWrapper'.
the first two i've been able to manipulate. the last one? completely unsuccessful.
Tried looking at the doc for ArrayWrapper and i'm... i'm lost. should I even be able to iterate over it?
getPyDataset breaks without returning anything. ditto with jsonDecode, .items(). I really don't wanna have to toString it and do some funky jsonEncode stuff unless I have to.
Any direction or support would help. the existing threads on reading an object wrapper seemed to be on the right track but didn't include any code I could use and used a clunky method. like victordcq said, 'You should not have to en/decode it to json'.
code for the curious.
def onMessageRecieved(self, payload):
NFSM = self.view.params.Nav_Filter_Sites_Map
system.perspective.print('in Message Handler: ' + str(type(NFSM)))
with gratitude,
-AM