Drag and drop tags into table in perspective session

Hi,
Right now we have a page in the designer that’s just a table so we can check some tag values from the historian at certain times. I was wondering if it would be possible to really have a perspective page where I would drag and drop or select tags I want from a tag tree view (which doesn’t seem to exist as of perspective 8.1.3) and those tags would populate my table.

I’ve seen this thread already:

But it seems awefully complicated especially when I know there is a tag tree view inside the new power chart that works really well already.

Thanks!

Hi @philippe.theroux,

You should be able to use the Tree component to do this; however, as you’ve eluded it might not be a simple task.

Hi @matthew.ayre,

I have found a simpler “solution” to my problem. Using the Perspective Power Chart, you can put showTagBrowser to true so it stays open, you can disable the button to make it collapse by putting showTagBrowserButton to false and you can shrink the Power Chart width so you may only see the Tag Tree and nothing else. From that point, you are able to select tags and click on “Add Selected Tags” and doing so will add that tag to the pens, where you’ll also be able to access said tag’s path, though not formatted correctly. You can then take those paths and reformat them in a custom property so you can actually use them.

Now that that’s done, you can populate your table with tag history binding like this:
image
To do so, you’ll have to make an array custom property where you’ll add a new object for each path from the pens paths you’ve reformatted earlier with an aggregate value (I use MinMax), an alias (I use the last part of the path and add _1, _2, … if there’s already one with that name) and of course path contains the path.

With that you’ve now populated your table, all you need to do is create a button that can remove them. For that, since all of the paths you have will be in the same order as those in the pens, you can simply make a dropdown where value = index of path and label = alias. The button will then have this code inside to remove said tag:
image

Finally if you want to do a clear all, you can simply use this:

self.getSibling(“PowerChart”).props.pens =

And that’s pretty much it, the only other thing I’ve done is put Date Time Inputs and bind those to my table’s date values to be able to have a range selector:

1 Like

That’s an interesting work around! Thank you for sharing your solution.

I’m guessing the only downside to this solution is customising the look of the tag tree? But the Power Chart tag tree does look pretty good anyway.

Yeah not much you can do to customize it indeed. Pretty much all the chart options are useless if you configure it like I did. Almost everything is set to false and I doubt you can do much with the styling.

Then again to be honest this screen looks good enough as is in my opinion. This screen mostly needs to be simple and intuitive and I think this does a good enough job for that.

1 Like

Hi Philippe.

You refer “you’ll add a new object for each path from the pens paths…”, how do you create this property dinamically depend on tag of pens of power chart are selected?, and how adapt the path of pens to path of history tag?

Thanks.

Hi @agavino ,

I am no longer working there nor with ignition and so I will answer you to the best of my memory.
First off, make a new page where you test what happens when you new tags in the Power Chart on the “pens” attribute on the side. You will see they all are built the same way and thus with a couple lines of code you can just put something along the lines:
if there are pens, iterate through the list of pens. For each pen, use the Python “replace” function or other similar functions whichever method you prefer to replace the bits that are not correct in the path and make it so the path is the one you wish to have.
The first question you asked I wasn’t quite sure what you meant but I’ll assume you meant to ask how I add the tags I select into the table. The “drag and drop” functionnality doesn’t work in what I did. I use the button “Add Selected Tags” and that will populate the “pens”. I believe I used event handlers to tell my table to populate if I recall correctly.

If it still isn’t clear enough, please ask again using screen captures or snips so I can better understand what you are trying to do.

Thanks!