# Pull an entire row from a sql dataset tag using expression

**URL:** <https://forum.inductiveautomation.com/t/pull-an-entire-row-from-a-sql-dataset-tag-using-expression/32426>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [February 19, 2020, 5:08pm UTC](https://forum.inductiveautomation.com/t/pull-an-entire-row-from-a-sql-dataset-tag-using-expression/32426 "2020-02-19T17:08:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![boster281](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@boster281](https://forum.inductiveautomation.com/u/boster281)\
**Post date:** [February 19, 2020, 5:08pm UTC](https://forum.inductiveautomation.com/t/pull-an-entire-row-from-a-sql-dataset-tag-using-expression/32426/1 "2020-02-19T17:08:24Z")

</div>

I am currently bringing an entire table from a SQL database to a dataset.  
I want pull an entire row from that dataset to another dataset where index = variable

---

<div class="post-metadata">

**Author:** ![osolorzano](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/osolorzano/32/6432_2.png) [@osolorzano](https://forum.inductiveautomation.com/u/osolorzano)\
**Post date:** [February 19, 2020, 9:02pm UTC](https://forum.inductiveautomation.com/t/pull-an-entire-row-from-a-sql-dataset-tag-using-expression/32426/2 "2020-02-19T21:02:21Z")

</div>

I’m not sure if you can directly from an expression function, but this can be done through scripting by first converting the dataset to a pydataset and making use of the getslice method to return a single row dataset like:

```auto
def get_row(dataset, index):
	pydata = system.dataset.toPyDataSet(dataset)
	row = pydata. __getslice__ (index, index+1)
	return row

```

If it has to be in an expression, then you can make use of the runScript() expression function. Just make sure that if this is for an expression tag that the script exists in the gateway scripting project.

---

<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:** [February 20, 2020, 12:18am UTC](https://forum.inductiveautomation.com/t/pull-an-entire-row-from-a-sql-dataset-tag-using-expression/32426/3 "2020-02-20T00:18:09Z")

</div>

Try the [view()](https://www.automation-pros.com/simaids/doc/expression.view.html) expression binding:

```auto
view("Select * Where index == args[0]", {Path.To.Dataset}, {Path.To.Variable})

```

…after installing my [Simulation Aids Module](https://inductiveautomation.com/moduleshowcase/module/automation-professionals-llc-simulation-aids). (:

---

<div class="post-metadata">

**Author:** ![boster281](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@boster281](https://forum.inductiveautomation.com/u/boster281)\
**Post date:** [February 20, 2020, 2:01pm UTC](https://forum.inductiveautomation.com/t/pull-an-entire-row-from-a-sql-dataset-tag-using-expression/32426/4 "2020-02-20T14:01:40Z")

</div>

This does seem like exactly what I am looking for but I had some issues trying to get it working.  
Where is there more information about the simulation aide module.  
I downloaded it yesterday after looking at a few of your other responses to people having some of the same questions but the link to the sample project seemed broken and the documentation is hard to follow.

Thanks

---

<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:** [February 20, 2020, 3:08pm UTC](https://forum.inductiveautomation.com/t/pull-an-entire-row-from-a-sql-dataset-tag-using-expression/32426/5 "2020-02-20T15:08:39Z")

</div>

The posted demo project is for Ignition v8. For v7.9, you’d want [this older demo](https://www.automation-pros.com/simaids/SimAidsDemo2015-10-13.proj).

I’m open to content donated to improve the documentation. It is a free module, after all. (:

---

<div class="post-metadata">

**Author:** ![boster281](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@boster281](https://forum.inductiveautomation.com/u/boster281)\
**Post date:** [February 20, 2020, 4:22pm UTC](https://forum.inductiveautomation.com/t/pull-an-entire-row-from-a-sql-dataset-tag-using-expression/32426/6 "2020-02-20T16:22:41Z")

</div>

Thank you for the link.
