# Display database row in vertical format

**URL:** <https://forum.inductiveautomation.com/t/display-database-row-in-vertical-format/10417>\
**Category:** Ignition\
**Created:** [August 31, 2015, 9:23pm UTC](https://forum.inductiveautomation.com/t/display-database-row-in-vertical-format/10417 "2015-08-31T21:23:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![qversa](https://avatars.discourse-cdn.com/v4/letter/q/35a633/32.png) [@qversa](https://forum.inductiveautomation.com/u/qversa)\
**Post date:** [August 31, 2015, 9:23pm UTC](https://forum.inductiveautomation.com/t/display-database-row-in-vertical-format/10417/1 "2015-08-31T21:23:14Z")

</div>

Hi, I want to display a single row from a database in a vertical fashion instead of the typical table (or row) fashion. I have multiple label components on the window and I would like to assign the returned fields from the database row to each label. I assume I will be using system.db.runPrepQuery but I am not sure how to get the returned PyDataSet into the labels. Currently I am binding each labels Text property with a SQL Query but this seems highly inefficient. Any ideas?

---

<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:** [September 1, 2015, 12:44am UTC](https://forum.inductiveautomation.com/t/display-database-row-in-vertical-format/10417/2 "2015-09-01T00:44:18Z")

</div>

Bring the complete dataset with a single query into a custom property of your root container, unless you already have it in a table or some other component (possibly the component that picks your row number). In each edit field/label, include a custom string component that will hold the column name. Then bind the field’s value to something like`try({Root Container.myDatasetProp}[{Root Container.myRowNumber},{Root Container.editField.myColumnName}], 0)`This approach is appropriate if you know the column names in advance. Otherwise, the template repeater is the tool to use. You’d need the actual column names from your data set as rows in a new dataset (for the repeater). Try this expression with the objectScript() function from my Simulation Aids module:`objectScript("system.dataset.toDataSet(['column'], [[x] for x in args[0].columnNames])",
  {Root Container.myDatasetProp})`Make sure you get the [latest version](https://inductiveautomation.com/forum/viewtopic.php?f=50&t=14330)…

---

<div class="post-metadata">

**Author:** ![qversa](https://avatars.discourse-cdn.com/v4/letter/q/35a633/32.png) [@qversa](https://forum.inductiveautomation.com/u/qversa)\
**Post date:** [September 1, 2015, 11:32pm UTC](https://forum.inductiveautomation.com/t/display-database-row-in-vertical-format/10417/3 "2015-09-01T23:32:34Z")

</div>

Thanks Phil, exactly what I needed!
