# \[SOLVED\] Add alternating color to Perspective table rows through scripting after sorting the data

**URL:** <https://forum.inductiveautomation.com/t/solved-add-alternating-color-to-perspective-table-rows-through-scripting-after-sorting-the-data/73649>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [May 12, 2023, 2:12pm UTC](https://forum.inductiveautomation.com/t/solved-add-alternating-color-to-perspective-table-rows-through-scripting-after-sorting-the-data/73649 "2023-05-12T14:12:25Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [May 30, 2023, 6:19pm UTC](https://forum.inductiveautomation.com/t/solved-add-alternating-color-to-perspective-table-rows-through-scripting-after-sorting-the-data/73649/13 "2023-05-30T18:19:19Z")

</div>

> [@Sorting Using Python Sorted Function](https://forum.inductiveautomation.com/t/sorting-using-python-sorted-function/74181/2):
>
> sorted accepts a keyword argument key: [https://docs.python.org/2.7/library/functions.html#sorted](https://docs.python.org/2.7/library/functions.html#sorted) key should be a callable that returns a sortable item per value. Typically this is a simple lambda. Simplifying your script a little, and running it on some test data, you can return a sorted list with something like this: returnedData = system.dataset.toPyDataSet(system.dataset.toDataSet( ["Clock Number", "Name", "Department", "Hours"], [["100003683", "Bob Vance", 9, 24.0], ["10000803…

---

_[View the full topic](https://forum.inductiveautomation.com/t/solved-add-alternating-color-to-perspective-table-rows-through-scripting-after-sorting-the-data/73649)._
