# Problems with sorting dataset (component error)

**URL:** <https://forum.inductiveautomation.com/t/problems-with-sorting-dataset-component-error/104819>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [April 8, 2025, 9:52am UTC](https://forum.inductiveautomation.com/t/problems-with-sorting-dataset-component-error/104819 "2025-04-08T09:52:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kneven](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@Kneven](https://forum.inductiveautomation.com/u/Kneven)\
**Post date:** [April 8, 2025, 9:52am UTC](https://forum.inductiveautomation.com/t/problems-with-sorting-dataset-component-error/104819/1 "2025-04-08T09:52:06Z")

</div>

Hi,

I have some issues regarding sorting a dataset on the binding for a time series chart. Tried looking around the forum for some answers but could find something that matches this case.  
The gateway is running on version 8.1.47.

My setup on my data-binding looks like this, pretty straight forward, and I get the result to show in the chart.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/b/4b3a45196f1ba6e7693c5bea5f2ee82addf4b3f2.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/9/d9bd53b64cc143ca37444e1ea09a099500829725.png)

Then I'm adding a script transform, and converting the dataset to a pyDataset. This still works, and I'm getting my results.

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

But when applying the dataset.sort function I get an component error on the chart even tough the script has no errors and returns a new dataset.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/4/14fdd0632a1c2b515d40d7230d160e59a881e922.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/d/4d43a3d9fd039b3c168de039647947fcf5524e2f.png)

I have no errors in the logs, or on the component itself. The returned dataset on the binding looks correct but the chart doesn't display it. Removing the script transform doesn't work, and it seems to me that I need to delete the chart and redo the process.

Does this look correct or am I doing something completely wrong?

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [April 8, 2025, 12:06pm UTC](https://forum.inductiveautomation.com/t/problems-with-sorting-dataset-component-error/104819/2 "2025-04-08T12:06:25Z")

</div>

I don't understand.  
It's a timeseries chart, it's supposed to show things chronologically. If you sort your data according to anything else, then nothing makes sense.

What are you trying to do exactly ?

---

<div class="post-metadata">

**Author:** ![Kneven](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@Kneven](https://forum.inductiveautomation.com/u/Kneven)\
**Post date:** [April 8, 2025, 12:16pm UTC](https://forum.inductiveautomation.com/t/problems-with-sorting-dataset-component-error/104819/3 "2025-04-08T12:16:14Z")

</div>

That kind of makes sence. Im trying to make a duration diagram that shows the number of hours per year with a given load on a selected measurement object.

The data basis for the plot should be: "power data with one data point per hour, retrieved for all hours in a year, then sorted from the highest value to the lowest value. The x-axis would then be a running number."

Should be looking something like this:

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 8, 2025, 12:21pm UTC](https://forum.inductiveautomation.com/t/problems-with-sorting-dataset-component-error/104819/4 "2025-04-08T12:21:10Z")

</div>

Then you need an XY chart, not a timeseries chart. The timeseries chart only works with time on the X axis.

---

<div class="post-metadata">

**Author:** ![Kneven](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@Kneven](https://forum.inductiveautomation.com/u/Kneven)\
**Post date:** [April 8, 2025, 1:31pm UTC](https://forum.inductiveautomation.com/t/problems-with-sorting-dataset-component-error/104819/5 "2025-04-08T13:31:19Z")

</div>

Thanks alot! 🙂
