I am trying to historize datasets in Canary Historian and retrive their value which I am able to do but I can't seem to read the values in the historized dataset.I am also not able to convert it to a dataset as it is unicode.
ds1[0][1] is of type unicode
per your print statement so that is why you can't directly convert that to a dataset.
To use system.dataset.toDataSet()
system.dataset.toDataSet - Ignition User Manual 8.1 - Ignition Documentation you should either feed it the full PyDataSet directly like system.dataset.toDataSet(ds1)
or you can manually make a dataset with a row of headers and list of lists, like system.dataset.toDataSet(['header1', 'header1', [[1,2], [3, 4]])
Worth pointing out system.tag.queryTagHistory
returns a Dataset initially, your ds
variable is already a basic dataset.
so how can I access the values in the dataset (ds1[0][1]) that is in unicode? or how to convert unicode to dataset?
You already have a dataset. The value at row 0, column 1, is the string representation of a dataset, meaning that the data in the inner dataset has already been lost. It's not immediately clear to me whether this is a thing Canary is even capable of supporting through our queryTagHistory
API; every Ignition system is going to expect a tag history result to be 'scalar' in nature, even if datasets are technically capable of this nesting operation.
You will probably need a more specific Canary function/operation to retrieve the 'nested' datasets in a more purpose-built structure. I don't know whether Canary already contains such functionality or not.