Referencing Template Canvas Parameters in Expressions

Here’s a breakdown of what I have:

Ignition Version: 8.1

Module: Vision

A Template Canvas with Templates that each have Custom Properties assigned to them. I understand these Custom Properties are saved in the Parameters field of the Canvas’s Templates Dataset.

I am trying to reference these Custom Properties in an Expression binding but I cannot seem to figure out how. I can correctly reference the entire Parameters field in the Templates dataset, but I can’t seem to figure out how to reference any of the individual Parameters within it.

In my Expression, I can get to the Parameters using:

{Root Container.Path.to.Template.Canvas.templates}[0,”parameters”]

Which results in something like:

{"property1":"value1","property2":"value2"}

But how do I reference the properties within that string?

I can sort of make it work by running the Parameters string through a mix of split and replace functions, but I feel like there’s got to be a simpler way to do it.

Is there an easy way to do this?

Looks like its a json string, have you tried using jsonGet?

eg:

jsonGet(
    {Root Container.Path.to.Template.Canvas.templates}[0,”parameters”],
    "property1"
)

It looks like you posted your code as quote blocks, use preformatted text instead, see Wiki - how to post code on this forum.

1 Like

Well, that was it….

Funny thing is, I saw jsonGet in the Expression binding documentation but the syntax looked a little different and so I never tried it. Or maybe that was getCSV. Either way, this worked! Thank you so very much!