Nested Datasets, or arrays within a dataset

Hi guys,
I was wondering about the level of support there is for nesting datasets, or at least putting arrays in a column of a dataset. It seems doable based on my limited testing in the script console in Ignition 8.1.17, but I worry if I start doing that in a few places, will I be doing something I shouldn’t?

I don’t believe a dataset can have a column of type dataset.

But if you need to keep a collection of items together, why not a dictionary? You can nest dictionaries as deep as you want.

d = {"ds": firstDataset,
        "array":[1,2,3,..],
         "children":  [
               {"ds":anotherDataset, "array":[4,5,6,...], "children":[]},
               {"ds":thirdDataset, "array":[6,7,8,..],"children":[# could add even more here]
                              ]
      }

If you explain exactly what your problem is and what you’re trying to accomplish people here will be able to offer better suggestions.

3 Likes

Yup. Datasets themselves tolerate anything at all if you declare the column type as Object (which you can do with the DatasetBuilder class quite easily). Try to stuff them in a dataset tag and it'll blow up on you (very limited allowed types). Or try to put them in a message payload and it'll blow up on you (must be serializable).

3 Likes