Perspective: Bind instance parameter using scripts

Good morning.

In Ignition 8.1.15, I have written a script to build the view instances of a Flex Repeater. One of the view’s parameters is a tag value, and I’d like to bind it through the script.
If I just assign the value to the parameter, it logically doesn’t bind to the tag, and the parameter won’t change when the tag value changes.

As I have programmed the script, “tagValue” is static, I need it to be dynamic.

Best regards.

Instead of passing the value to the tagValue parameter, add an indrect tag binding on tagValue in the view.

1 Like

I have created a new parameter (tagPath) in the view and bound the label to this parameter:

image

I have modified the script that creates the instances in the Flex Repeater, but the final result is not what I expected. Instead of displaying the value of the tag, “value” is displayed:

Script:

Flex Repeater:
image

Best Regards.

Use an indirect tag binding, add a script transform to add the units. My example uses a custom property called tagValue
image

binding on tagValue

Transform script:

def transform(self, value, quality, timestamp):
	stringOut = '{} {}'.format(value, self.params.tagUnits)
	return stringOut

It works perfectly with both Expression Binding and Indirect Tag Binding.

I was editing the wrong view :frowning:

Thanks.

1 Like

I wish i could say I’ve never done that. But I have. Sometimes often.