# Sort the table header in perspective

**URL:** <https://forum.inductiveautomation.com/t/sort-the-table-header-in-perspective/36057>\
**Category:** Ignition\
**Tags:** scripting, perspective\
**Created:** [June 25, 2020, 8:26pm UTC](https://forum.inductiveautomation.com/t/sort-the-table-header-in-perspective/36057 "2020-06-25T20:26:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rodolfobravogarcia](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/rodolfobravogarcia/32/14082_2.png) [@rodolfobravogarcia](https://forum.inductiveautomation.com/u/rodolfobravogarcia)\
**Post date:** [June 25, 2020, 8:26pm UTC](https://forum.inductiveautomation.com/t/sort-the-table-header-in-perspective/36057/1 "2020-06-25T20:26:54Z")

</div>

Hello community  
I have a problem and I can’t find the solution  
it is the head of a table in perspective I cannot fit them as I want they are ordered according to the data from smallest to largest  
my question is is there any way to accommodate the headers?  
What I’m doing is from a dataset build a list and for each iteration make an append with 4 data but they don’t fit in the order of the append  
does anyone have any suggestions or tips that I can use to accommodate my data

this is part of the code i am using

```auto
data = result.getDataset()
		pyData = system.dataset.toPyDataSet(data)
		list1 = []
		for i in range(data.rowCount):
			if data.getValueAt(i,1) != 0:
				list1.append( {'Hora': data.getValueAt(i,0),'Produccion': data.getValueAt(i,1),'Rechazados': data.getValueAt(i,3),'Eficiencia': str(data.getValueAt(i,2))+str(" %")})
		return list1

```

the data shown in the table is the following, what I want is that they are ordered in production, rejected and efficiency

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/b/3b7b8e43e4f333b2c358dfd7ebfe0d3651dd1b3e.png)

---

<div class="post-metadata">

**Author:** ![DavidWisely](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/davidwisely/32/10482_2.png) [@DavidWisely](https://forum.inductiveautomation.com/u/DavidWisely)\
**Post date:** [June 26, 2020, 12:07am UTC](https://forum.inductiveautomation.com/t/sort-the-table-header-in-perspective/36057/2 "2020-06-26T00:07:45Z")

</div>

Your using a dictionary to store the 4 items of data. Dictionaries do not keep their order.  
You could change to using a list instead:

```auto
	data = result.getDataset()
	pyData = system.dataset.toPyDataSet(data)
	list1 = []
	for i in range(data.rowCount):
		if data.getValueAt(i,1) != 0:
			list1.append( [data.getValueAt(i,0), data.getValueAt(i,1),data.getValueAt(i,3), str(data.getValueAt(i,2))+str(" %")])
	
	headers = ['Hora', 'Produccion', 'Rechazados', 'Eficiencia']
	ds = system.dataset.toDataSet(headers, list1)

```

---

<div class="post-metadata">

**Author:** ![rodolfobravogarcia](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/rodolfobravogarcia/32/14082_2.png) [@rodolfobravogarcia](https://forum.inductiveautomation.com/u/rodolfobravogarcia)\
**Post date:** [July 1, 2020, 11:00am UTC](https://forum.inductiveautomation.com/t/sort-the-table-header-in-perspective/36057/3 "2020-07-01T11:00:09Z")

</div>

thank you very much if it worked
