# How to check if a variable is type BasicStreamingDataset

**URL:** <https://forum.inductiveautomation.com/t/how-to-check-if-a-variable-is-type-basicstreamingdataset/89054>\
**Category:** Ignition\
**Tags:** ignition81, perspective, scripting\
**Created:** [April 18, 2024, 2:53pm UTC](https://forum.inductiveautomation.com/t/how-to-check-if-a-variable-is-type-basicstreamingdataset/89054 "2024-04-18T14:53:53Z")\
**Posts on this page:** 6\
**Page:** 1

<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:** [April 18, 2024, 2:53pm UTC](https://forum.inductiveautomation.com/t/how-to-check-if-a-variable-is-type-basicstreamingdataset/89054/1 "2024-04-18T14:53:53Z")

</div>

I have a named query in Perspective with the return format set to Dataset.

Using a script transform I am able to identify that the data type is:

```auto
com.inductiveautomation.ignition.gateway.datasource.BasicStreamingDataset
```

I would like to use the following script transform to return True / False however I always get the result False. Hence, a BasicStreamingDataset is not a BasicDataset. What do I need to compare against?

```auto
from com.inductiveautomation.ignition.common import BasicDataset
return isinstance(value, BasicDataset)
```

Thanks for any info.

---

<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 18, 2024, 2:59pm UTC](https://forum.inductiveautomation.com/t/how-to-check-if-a-variable-is-type-basicstreamingdataset/89054/2 "2024-04-18T14:59:34Z")

</div>

Check against the `Dataset` **interface** , not any implementation.

---

<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:** [April 18, 2024, 6:03pm UTC](https://forum.inductiveautomation.com/t/how-to-check-if-a-variable-is-type-basicstreamingdataset/89054/3 "2024-04-18T18:03:57Z")

</div>

I don't understand what you mean here "check against the interface, not any implementation".

Why would a BasicStreamingDataset not be of type BasicDataset?

My real problem ([XY problem - Wikipedia](https://en.wikipedia.org/wiki/XY_problem)) is a value change script on the value property of my dropdown is being populated by the named query mentioned above which returns type dataset. What is happening is when my named query returns nothing or is invalid I get an error on that change script. I was investigating how to check for this condition in my value change script by trying different options in the script transform.

---

<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 18, 2024, 6:11pm UTC](https://forum.inductiveautomation.com/t/how-to-check-if-a-variable-is-type-basicstreamingdataset/89054/4 "2024-04-18T18:11:30Z")

</div>

Both `BasicDataset` and `BasicStreamingDataset` are classes that implement the `Dataset` interface. That is, they each have the methods required by the interface, but execute them differently "under the hood". All of Ignition's dataset properties accept any implementation that follows the interface rules. All of Ignition's methods and functions that specify returning a `Dataset` can return any implementation that fits their needs. You should accept any implementation that follows the interface rules. Do that by checking `isinstance(value, Dataset)`, not checking against a specific class.

This is exactly like checking `basestring` in python to accept either `str` or `unicode` types.

---

<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:** [April 18, 2024, 6:36pm UTC](https://forum.inductiveautomation.com/t/how-to-check-if-a-variable-is-type-basicstreamingdataset/89054/5 "2024-04-18T18:36:47Z")

</div>

I see now. Is this the proper way to check against the interface?

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

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 18, 2024, 6:45pm UTC](https://forum.inductiveautomation.com/t/how-to-check-if-a-variable-is-type-basicstreamingdataset/89054/6 "2024-04-18T18:45:35Z")

</div>

Yes, but no need to alias.

```auto
from com.inductiveautomation.ignition.common import Dataset

```

would work just as well.
