# Script help: Holiday edge case lead to empty datasets

**URL:** <https://forum.inductiveautomation.com/t/script-help-holiday-edge-case-lead-to-empty-datasets/66975>\
**Category:** Ignition\
**Created:** [November 28, 2022, 3:07pm UTC](https://forum.inductiveautomation.com/t/script-help-holiday-edge-case-lead-to-empty-datasets/66975 "2022-11-28T15:07:53Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [November 28, 2022, 3:49pm UTC](https://forum.inductiveautomation.com/t/script-help-holiday-edge-case-lead-to-empty-datasets/66975/9 "2022-11-28T15:49:32Z")

</div>

> [@zacharyw.larson](#):
>
> I think "an error of calling a variable before it is defined" might be so common that there is a common solution.

There is, don't do it.

The problem here is that you are trying to index an empty list. You should make sure that there is data in the list prior to trying to access it if there is a chance that the list is empty.

```python
#assuming that datasetIn is a pyDataSet
if datasetIn.rowCount:
    for row, nextRow in zip(datasetIn, datasetIn[1:]):

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/script-help-holiday-edge-case-lead-to-empty-datasets/66975)._
