Skip to end of metadata
Go to start of metadata

Assuming both tables are identical, you can use this scripting in a button to merge two (2) Power Tables

Step-by-step guide


  1. use this code in a button 

ds1 = event.source.parent.getComponent('Power Table 1').data
ds2 = event.source.parent.getComponent('Power Table 2').data

def combine_datasets(dataset_list):

	# step 1 create the header list (this is assuming both tables are IDENTICAL !!
	column_list = []
	column_type = []
	for column_index in range(dataset_list[0].getColumnCount()):
		column_list.append(dataset_list[0].getColumnName(column_index))
		column_type.append(dataset_list[0].getColumnType(column_index))
	print column_type

	# step 2 collect the actual data (rows of data)
	all_row_data = []
	for dataset in dataset_list:
		for row in range(dataset.getRowCount()):
			row_data = []
			for col in range(dataset.getColumnCount()):
				row_data.append(dataset.getValueAt(row, col))
			all_row_data.append(row_data)
				
	return system.dataset.toDataSet(column_list, all_row_data)

event.source.parent.getComponent('Power Table 3').data = combine_datasets([ds1, ds2])

or download and import the example attached in this Ignition 7.9.14 .proj


Merge Power Tables 7914.proj

https://docs.inductiveautomation.com/display/DOC79/Datasets