# Create dataset with expression

**URL:** <https://forum.inductiveautomation.com/t/create-dataset-with-expression/73297>\
**Category:** Ignition\
**Created:** [May 5, 2023, 2:25am UTC](https://forum.inductiveautomation.com/t/create-dataset-with-expression/73297 "2023-05-05T02:25:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![R\_S](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@R\_S](https://forum.inductiveautomation.com/u/R_S)\
**Post date:** [May 5, 2023, 2:25am UTC](https://forum.inductiveautomation.com/t/create-dataset-with-expression/73297/1 "2023-05-05T02:25:56Z")

</div>

Is it possible to create a dataset using expression language only?

The scripting equivalent would be system.dataset.toDataSet, is it possible without using runScript?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [May 5, 2023, 2:49am UTC](https://forum.inductiveautomation.com/t/create-dataset-with-expression/73297/2 "2023-05-05T02:49:11Z")

</div>

No; all native Ignition expressions require an existing dataset. There is a toDataSet() expression for type casting existing datasets, but there is no built in expression that can form a dataset from a list of header names and a list of lists.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 5, 2023, 6:07am UTC](https://forum.inductiveautomation.com/t/create-dataset-with-expression/73297/3 "2023-05-05T06:07:24Z")

</div>

If you can use JSON rather than a dataset you might be able to use `jsonFormat()` or `jsonSet` to create the set.  
[https://docs.inductiveautomation.com/display/DOC81/JSON](https://docs.inductiveautomation.com/display/DOC81/JSON)

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [May 5, 2023, 12:11pm UTC](https://forum.inductiveautomation.com/t/create-dataset-with-expression/73297/4 "2023-05-05T12:11:12Z")

</div>

Can I ask what exactly it is you're trying to do, what is your use case? I know the general advice is to avoid runScript but sometimes it's not possible. However if you explain the end goal there may be different ways to accomplish it (there's always 5 different ways to do the same thing in Ignition lol).

---

<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:** [May 5, 2023, 12:13pm UTC](https://forum.inductiveautomation.com/t/create-dataset-with-expression/73297/5 "2023-05-05T12:13:52Z")

</div>

Never tried, but would it be possible to create a dataset through json ?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 5, 2023, 5:14pm UTC](https://forum.inductiveautomation.com/t/create-dataset-with-expression/73297/6 "2023-05-05T17:14:35Z")

</div>

> [@pascal.fragnoud](#):
>
> ... would it be possible to create a dataset through Json?

I don't know. I found JSON much easier to work with and when creating bindings you can inspect the binding preview to get an idea if it's working. With the document format one can't.
