EDIT: In writing this post, I determined the answer to my own question. Not regarding the columnRearrange, but regarding the use of the PropertyChange events.
I have an EasyChart which dynamically changes between Realtime Mode and Historical Mode based on the state of the current batch. Live data when the batch is running, historical data when in-between batches. All data is coming from the Tag Historian.
I have a table which I would like to link to the EasyChart such that each selected Pen is represented by a column in the table, and the table displays data within the current time-window of the EasyChart.
I have been able to sync the displayed columns to the selected Pens, but not in a way that also allows the table to update in real time when the EasyChart is in Realtime Mode.
Here are the details:
Chart Mode dynamically set by Expression Binding to match the batch state
Start Dateand Historical
Outer Range Startset by Expression Binding to the batch start time
End Dateand Historical
Outer Range Endset by Expression Binding to the batch end time
Tag Pensis hard coded with appropriate tags
Custom Property on the window’s
Value set by Tag History Binding
Tag Pensare represented in this query
Start Date Bindingand
End Date Bindingare bound to EasyChart
Date Rangeis set to Historical
Polling Modeis set to Off
- String selectedPens
Custom Property on Window’s
Populated by PropertyChange script on the EasyChart:
if event.propertyName == 'tagPens': data = system.dataset.toPyDataSet(event.source.tagPens) columnNames = ['t_stamp'] for row in data: if row['ENABLED']: path = row['TAG_PATH'] i = path.rfind('/') + 1 tag = path[i:] columnNames.append(tag) event.source.parent.selectedPens = columnNames
- The last step is to create a dataset for the table by filtering the dataView dataset on the list columnNames.
Ideally, I want to bind the the table’s
data property to something like this expression:
That in itself does not work, and I’m not strong with the Expression Language yet - so I thought I would ask for help.
A different solution is to use EasyChart’s PropertyChange script to parse the selected Pens and create the table’s dataset at the same time. I would then let the script also run on change of StartDate.
if event.propertyName == 'tagPens' or event.propertyName == 'startDate': data = system.dataset.toPyDataSet(event.source.tagPens) columnNames = ['t_stamp'] for row in data: if row['ENABLED']: path = row['TAG_PATH'] i = path.rfind('/') + 1 tag = path[i:] columnNames.append(tag) data = system.dataset.toPyDataSet(event.source.parent.dataView) newData =  for row in data: newRow =  for c in columnNames: try: newRow.append(row[c]) except IndexError: pass newData.append(newRow) columnNames = 'Time' event.source.parent.getComponent('tbl data').data = system.dataset.toDataSet(columnNames,newData)
My concern is that I will have 10 of these Chart/Table pairs per client, and potentially 30 clients active at the same time. This solution means I will unnecessarily parse the enabled Pens every time a Chart updates in Live Mode. Should I be concerned about that use of resources, or is it so small as to be moot?
Thank you for your time!