Indirect Tag History Binding in Perspective

I don’t see an option for indirect tag history binding in perspective.
Am I missing something?

1 Like

The ‘Select Tags’ area lets you specify an expression to use, which will let you run an expression and bring in a dynamic list of tag paths.

@PGriffith I tried using the expression to select the tags.
However, I am getting an error when I am using the expression binding.
To simplify, I just used a tag in both expression and direct binding.
Direct binding works while expression gives an error for same tag.
Am I using wrong syntax?


That's not how it works. You need to build an array with the right structure for the tags you want to read, then the 'Expression' property in your actual tag history binding just needs to evaluate to the array. See the manual section on tag history bindings in Perspective:

5 Likes

Thanks @PGriffith.

Thanks

image

I was able to use the array property Json.
Then also I was able to bind an expression for the path in the custom property array path value.

'[default]'+{view.custom.line}+'speed'

Was trying to figure this out so long.

Then I also had a script to figure out the outfeed difference from the start in the transform on the history binding for the data on a time series chart.


prevData=system.dataset.toPyDataSet(value)
	valueHeaders= ['t_stamp','Outfeed']
	data=[]
	for row in range(value.getRowCount()):
		t_stamp= value.getValueAt(row,'t_stamp')		
		Outfeed= value.getValueAt(row,'Outfeed')-int(prevData[0][1])
		data.append([t_stamp,Outfeed])	
	
	data= system.dataset.toDataSet(valueHeaders,data)
	
	return data

So many pieces to finally get it to work.
Ticks me off a bit because I think some power BI user is just going to drop something somewhere.
For a fleeting moment I was happy to figure it out.

Can you put the right format for his example in your response please. I am trying to do a similar thing, it worked for a regular tag binding to just do "[default]OEE/tag", but I still get a Error_ExpressionEval with that and an error_configuration when I tried [{"path": ""[default]OEE/tag"}] , but it isn't working

Take another look at the docs and the video example on Inductive University. You need to include aggregate, alias, and path for each tag. From the docs:

[
{
    "aggregate": "Average",
    "alias": "tank_temp",
    "path": "[default]Tank/03/Temperature"
},
{
    "aggregate": "Average",
    "alias": "setpoint",
    "path": "[default]Tank/03/Setpoint"
}
]

Also, you appear to have extra quotes on your path value

I assumed that if I wasn't aggregating or using an alias I wouldn't need to include them. I cannot find what to put if I don't want aggregation

You have to put something. Look into the docs on the system.tag.queryTagHistory function to choose an appropriate aggregate; you can choose one that doesn't interpolate, for instance.