I have some tags which contain style configurations for vision status charts. I'm attempting to create a perspective view of these status charts, and tie the colours used to the ones from the status charts (so they only need to be changed in one place).
I run a named query, and then use a script transform to add the column with the colours.
import java.awt.Color
styles_dataset = system.dataset.toPyDataSet(
system.tag.readBlocking(
["[default]my/tagpath"])[0].value
)
colour_dict = {}
for row in styles_dataset :
colour_dict[row[1]] = row[2] # number code : Color
colors_col = [colour_dict[status] for status in value.getColumnAsList(2)] # read from status code column
dataset_w_colors = system.dataset.addColumn(value, colors_col, "color", java.awt.Color)
return dataset_w_colors
However, I get the following error (which i can't seem to ctrl-c):
(Also, thinking about it, it's unlikely this method will work anyways, as I am planning to use the DeriveFieldsFromData portion of a perspective xy chart to display the data. So, I'll just manually stringify the colours, I suppose)
Persistence doesn't use Java serialization, and more broadly speaking, Java serialization is the devil and currently being excised from the platform wherever possible.