Sparkline Dynamic Tag History Expression Binding

Hi,

I would like to use a sparkline display along with my transmitter value in Perspective. My goal is to provide a tag path to the view that contains the transmitter and sparkline to make them interactive. The transmitter parameter passing works fine, but I cannot get the sparkline to work properly.

According to this video, it should be possible to create a custom array of objects, with each object containing values for path, alias, and aggregate and use it in a Tag History Binding. The video is for a table but I think it should work for a sparkline as well since they both use Tag History Binding

https://inductiveuniversity.com/videos/tag-history-binding—expression/8.0

I followed the format in the manual.;

"Using Dynamic Tag Paths

Tag History bindings have the option to list out Tag paths, or to use an expression to build a Tag path. It is common to create a dynamic path or set of paths as a component property, that you then reference in other places. You can use as many Tag paths as you want, but they must all follow this format:

key [array] 

    [0] {object}
        aggregate value
        alias value
        path value
    [1]{object}
        aggregate value
        alias value
        path value

"

Here is my CUSTOM property for the sparkline:

When I bind the Tag History directly to a tag, it works fine, but when I try to use an expression, I get an error message:

What am I doing wrong here? The PV is the data source for both the transmitter and sparkline. I know the sparkline uses tag history whereas the transmitter uses direct or indirect tags, but making the sparkline dynamic should be as simple as making the transmitter dynamic.

I can make the tag binding dynamic by using a parameter. All this does is to alter the tag path by adding some text to it.

Why can’t the same option be used in a Tag History Binding? I understand a dataset is required, but if the configuration can take a direct tag path and create the dataset behind the scene, why can’t it use a parameter to alter the tag path and do the same thing as a direct path?

Thank you,
Ali

I don’t think it accepts default as an aggregate. Try something explicit, like average.

Did you finally get the answer? I am trying to do the same.

Hi Oscar,
I ended up using a workaround since Perspective doesn’t support indirect history tag binding.

I bound the sparkline PROPS-points to a view parameter called Sparkline.

Then I bound the Sparkline parameter from my embedded view to a static tag history.

As workarounds go, it’s not too bad, but I wish Perspective would support indirect tag history binding.

Good luck.

@Ali.Etezadkhah,

@deon.korb was almost right. aggregate: default doesn’t appear to be supported. aggregate: Average works (case sensitive)

I omit the alias parameter, as I believe it’s useless with a sparkline, and I omit the aggregate parameter, assuming it defaults to “average” - and my original query mode was “AsStored”.

(someone please correct me if I’m wrong).

Still, tag history indirection would be nice.

I figured out how to use the indirect tag history binding and described for an timeseries chart. If you delete the key values of aggregate and alias, it works for the sparkline.