Ignition Power Chart, save and restore setup

Hello dear colleagues,

This is a question about Power Chart. I have a user who does trends display configurations using the browser tag.

But he wants to keep all his setup to use them during the next sessions. He also need to be able to switch from on trends setup to another.

Is there a way to save and restore Power chart configurations to files or by another means?

Else, what is your best or recommended way to comply with my user requirement ?

Thanks
Cyril

Check this exchange resource: Ignition Exchange | Inductive Automation

It saves the data directly into database tables and then allows retrieval of that data.

Oops... this is Perspective, not Vision.

Try this for inspiration: Ignition Exchange | Inductive Automation

2 Likes

A possible solution is to save the config as a json encoded string into a dataset on a button press.

You could then generate a dropdown that will get values from that dataset.

If you din't want people to see other options, have a column in the dataset with the username, and just show options with matching usernames.

This could also be done with a database and named queries

3 Likes

Thanks @Hayden_Watson and @bschroeder

I tray something (dirty) like that, but without success.

Save json pens to customs :
image

Button with onclick action :

Custom mapped to memory tag array. Index according to drop down list.

Restore button : from custom liked with memory tag array to power chart :

You don't want to save the entire power chart... you want to save the configuration of the power chart.

I would add two buttons and a drop down as a basic example.

A save button would have a script something like:

dataset = system.tag.readBlocking("Your Dataset Tag Here")[0].value
axes = system.util.jsonEncode(self.getSibling("PowerChart").props.axes)
pens = system.util.jsonEncode(self.getSibling("PowerChart").props.pens)
username = self.session.props.auth.user.userName

dataset = system.dataset.addrow(dataset, ["Option name", axes,pens,username]
system.tag.writeAync("Your Dataset Tag Here",dataset)

Have some dropdown with a binding to find the names of your options.

then a restore button with something along the lines of:

dataset = system.tag.readBlocking("Your Dataset Tag Here")[0].value
for row in range(dataset.getRowCount):
...iterate through dataset to find the saved data....
self.getSibling("PowerChart").props.axes = system.util.jsonDecode(the_axes_value)
self.getSibling("PowerChart").props.pens = system.util.jsonDecode(the_pens_value)

You'll need to handle the bindings, some way of entering the name of you new saved option etc. But that should be a start

2 Likes

@bschroeder, yes, I would like to save pens part of json tree only
But, I will try you second link : Tag Historian Viewer from @erik.forsgren
It seems to do what I need exactely.

image

1 Like

I finnaly find a solution with a customized version of :

It did not work out of box with sqlite database, but I manage to do it.