Skip to end of metadata
Go to start of metadata


The MES Analysis Selector provides various customizable Settings to further filter or sort the resulting dataset (which usually gets bound to or pushed out to an Ignition Table component. The Row Limit and Descending Order settings have some inconsistent behavior when used together, however (fixed in 2.9.3 SP11).

Applies To and Version Info

This feature applies to OEE 2.0 module 2.9.3 SP10 or earlier.


The Row Limit feature works fine at first. For example, if you set it equal to 5 (as shown to the right), you'll get no more than 5 rows of data in your resulting dataset.

If you then utilize the Descending Order feature (as shown to the right), the dataset will be sorted in descending order, as expected. However, the Row Limit feature will now be 'stuck' always returning just the last N rows in the dataset and never the first N, as would be expected (i.e. the row limit occurs before the descending order sort, which results in the wrong N rows being displayed). Even after the Descending Order feature is removed, Row Limit continues to provide the last N items and not the first N of the ascending order list.

Results are chronological, from left to right, in the columns below:

Row Limit and
Desc. Order
not yet used

Row Limit = 2
Desc. Order not yet used

Row Limit = 2
Desc. Order = True

Row Limit = 2
Desc. Order = False






The preferred workaround is just to upgrade to SP11, since the bugs are fixed.

The workaround for SP10 is to stop using the built-in Row Limit and  Descending Order settings in the MES Analysis Selector component and handle both functions with a script in the afterUpdate event handler.

1. Drag a Numeric Text Field and a Check Box component onto the screen. These will be read from within the script below.

2. Paste the following script into the afterUpdate event handler area (set its Enable checkbox to enable this event).

 Script for afterUpdate event handler
	# ===== ROW LIMIT ============================
	#Read the Numeric Text Field to get the number of rows to limit to
	rows = self.parent.getComponent('Numeric Text Field').value
	limitedDataset = []
	for i in range(data.getRowCount()):
		#List comprehension to assemble one row of data at row=i
		oneRow = [data.getValueAt(i,j) for j in range(data.getColumnCount())]
		#Append the row to the dataset
		#Stop at the row limit pulled in from the Numeric Text Field
		if i == rows-1:
	#List comprehension to assemble a list of all column names for the header row
	header = [colName for colName in data.getColumnNames()]
	#Assemble the final dataset from the header row and the data rows
	#(also converts from PyDataset to Ignition Dataset)
	dataset = system.dataset.toDataSet(header, limitedDataset)

	orderByColumn = self.getAnalysisSettings().getOrderBy()
	if self.parent.getComponent('CheckBox').selected:
		descendingDataset = system.dataset.sort(dataset,orderByColumn,False)
		dataset = descendingDataset
		ascendingDataset = system.dataset.sort(dataset,orderByColumn,True)
		dataset = ascendingDataset

	# ===== DISPLAY RESULTS ON TABLE ===========================
	#Push the resulting Ignition Dataset to the table
	self.parent.getComponent('Analysis Table').data = dataset
	#Nothing to return (data is already pushed out to the table)
	return None

This script only works when there is only one selection in the Order By parameter. It will throw an error if there are two or more selected.

3. Delete any data binding between the MES Analysis Selector and the Ignition Table components (otherwise it will overwrite the rows displayed with incorrect data).



OEE, MES Analysis Selector, Row Limit, Descending Order

  • No labels