Indirect binding for the multiple screens and trends without using UDT and template repeater

Hello everyone,

The production line consists of a batch-processing machine connected to an ignition platform. A batch processing machine has multiple lines, such as line = A, line = B, line = C, and line = D. All lines have identical graphics for monitor and control purposes.

So, how can you configure only one graphic and bind the data using indirect tag binding instead of creating multiple graphics for multiple lines without using template repeaters and UDTs?

How to configure only one main trend instead of creating multiple trends line-wise?

Why? They are very powerful tools that make design simpler.

All that is important here is that the tag paths have a similar structure.

So for instance, something like: 'Plant\Line_A\Status' would be easy to indirectly bind, you just add a custom property to the window/component and use that to hold the value of the Line you want to be shown.

This is a little more difficult, but still doable, and the method is still basically the same. Exactly how you do it depends on how your system is set up.

What have you tried doing and what result did you get and how was that result different from your desired outcome?

3 Likes

I think what you mean to ask is how to use indirect binding without passing an instance of the UDT to the template?

All of my templates generally have one parameter, the path to the UDT instance (string).
Then, internal properties with indirect bindings to the relevant UDT members using the path parameter replacement for the first portion of the member tag path.

You want to use a UDT, trust me. Then if you need to add a metric to every line you update the UDT and your one template and everything else populates.

If you want to have a trend on the template that doesn't use indirect binding you can just directly reference tags. You don't have to only use indirect bindings. The trend would be identical no matter the selected line, but the rest of the information would be filled in for the selected line using the indirection - I've done this alot.

1 Like

I know template repeaters and UDTs are very useful for creating multi-instance objects or screens and tags.

Yes, all line tag path is the same like a [Sample_Tags]Batching_machine/Line_A/Inlet_valve' is the same as for other lines, only line name changes like ``[Sample_Tags]Batching_machine/Line_B/Inlet_valve'.

I create a line-wise object in the main overview and add a screen swap function to move to another screen. All line-wise items are passed parameters such as tagpath, screen header name, and table name.

When I click on the object, it goes to the specific line graphics and displays the parameter of the line.

main overview

Pass the parameter in line wise object.

Created a master screen for the line and added custom properties such as tagpath, screen header name, and table name. This custom property is reflected in the data when selecting a specific line object from the main overview.

Add a custom property in the Main master line graphics.

Defined the all object tag path and Screen_header name using indirect tag binding.

My question is how to defined in the trends as per above function using?

You have to dynamically (script) construct the tagPens dataset of an EasyChart, inserting the dynamic part of the tag path where appropriate.

2 Likes

I still don't understand the question.

I don't see a trend on your page.

What tags would be included for Line_A and Line_B? That might clear things up.

I'm thinking you want the same trends for each line using the same indirect binding for the historical tag path?

If that assumption is correct, I made this script assuming that you have a template on a window. If you're just using a window you can remove the propertyName check and just use the visionWindowOpened script instead.

'''
toggle the template's updatePaths (BOOL) parameter from the vision window opened
script for the window that contains this template.
'''
if event.propertyName == 'updatePaths':
	defaultLine = 'Line_A'
	
	#get the "default" tagPens - configured with the default line indirect tag substring that is to be replaced
	tagPens = event.source.getComponent('Easy Chart').tagPens
	
	#at least one tagPen is configured
	if tagPens.rowCount > 0:
		tagPathIndex = tagPens.getColumnIndex('TAG_PATH')
		
		#create headers list, blank data list, and get the line parameter
		headers = list(tagPens.getColumnNames())
		newTagPens = []
		line = event.source.Line
		
		for pen in tagPens:
			newPen = list(pen)
			
			#replace default line substring with line parameter
			newPen[tagPathIndex] = pen[tagPathIndex].replace(defaultLine,line)
			
			newTagPens.append(newPen)
			
		#create and update dataset on the trend
		data = system.dataset.toDataSet(headers, newTagPens)
		if data is not None:
			self.tagPens = data

It grabs the existsing tagPens from the Easy Chart this is configured with the paths for the defaultLine (Line_A, or whichever one you choose).