# Power table - add blank row with scripted text between a groups of questions for a header

**URL:** <https://forum.inductiveautomation.com/t/power-table-add-blank-row-with-scripted-text-between-a-groups-of-questions-for-a-header/22258>\
**Category:** Ignition\
**Created:** [January 31, 2019, 4:26pm UTC](https://forum.inductiveautomation.com/t/power-table-add-blank-row-with-scripted-text-between-a-groups-of-questions-for-a-header/22258 "2019-01-31T16:26:52Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [January 31, 2019, 4:26pm UTC](https://forum.inductiveautomation.com/t/power-table-add-blank-row-with-scripted-text-between-a-groups-of-questions-for-a-header/22258/1 "2019-01-31T16:26:52Z")

</div>

Has anyone inserted blank rows with scripted text between groups of questions or values?

---

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [January 31, 2019, 5:01pm UTC](https://forum.inductiveautomation.com/t/power-table-add-blank-row-with-scripted-text-between-a-groups-of-questions-for-a-header/22258/2 "2019-01-31T17:01:24Z")

</div>

I’m not really sure what you’re asking here, could you clarify and maybe provide an example of what you’re thinking about?

---

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [January 31, 2019, 5:08pm UTC](https://forum.inductiveautomation.com/t/power-table-add-blank-row-with-scripted-text-between-a-groups-of-questions-for-a-header/22258/3 "2019-01-31T17:08:22Z")

</div>

I am alternating the background based on a set of questions, Above each set of questions I want to put a equipment name above each set. I have 2 power tables one shows the equipment in a certain location and the other show the equipment questions needed.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/aec776351c985d0ae77f1c5ada4cc72b935c4185.png)

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

---

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [January 31, 2019, 5:12pm UTC](https://forum.inductiveautomation.com/t/power-table-add-blank-row-with-scripted-text-between-a-groups-of-questions-for-a-header/22258/4 "2019-01-31T17:12:53Z")

</div>

Ok, I gotcha. How are you making this dataset? I’d say the best bet is to go ahead and insert a row with the equipment name (maybe use the span property to make the ‘title’ row to make it span both Question and Reading columns) when you’re making the dataset. If that isn’t possible you can do that after using system.dataset.addRow(), and again use span to make it look nicer.

---

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [January 31, 2019, 5:14pm UTC](https://forum.inductiveautomation.com/t/power-table-add-blank-row-with-scripted-text-between-a-groups-of-questions-for-a-header/22258/5 "2019-01-31T17:14:27Z")

</div>

the data set comes from a sql query

---

<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 1, 2019, 5:56pm UTC](https://forum.inductiveautomation.com/t/power-table-add-blank-row-with-scripted-text-between-a-groups-of-questions-for-a-header/22258/6 "2019-02-01T17:56:03Z")

</div>

Have you tried using the Treeview?

---

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [February 4, 2019, 12:58pm UTC](https://forum.inductiveautomation.com/t/power-table-add-blank-row-with-scripted-text-between-a-groups-of-questions-for-a-header/22258/7 "2019-02-04T12:58:36Z")

</div>

How does treeview work? I have never used it. After looking in to it i don’t think that is what I am looking for, I need it to be in the table format.

---

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [February 5, 2019, 12:31pm UTC](https://forum.inductiveautomation.com/t/power-table-add-blank-row-with-scripted-text-between-a-groups-of-questions-for-a-header/22258/8 "2019-02-05T12:31:41Z")

</div>

After working on it some more, I got the query going in to a data set first and then I can alter the data there for the blank rows and any other items I need and the power table uses a expression to populate the data. Has any one approached it this way and know how to add blank rows in to the data?

---

<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 5, 2019, 1:03pm UTC](https://forum.inductiveautomation.com/t/power-table-add-blank-row-with-scripted-text-between-a-groups-of-questions-for-a-header/22258/9 "2019-02-05T13:03:36Z")

</div>

The most efficient approach is to start with an empty list for output rows, then loop through your input rows. For each input row that needs an accompanying blank row, add it to your list before/after adding the input row to the output list. After the loop, feed the output row list to system.dataset.toDataSet().

---

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [February 5, 2019, 1:19pm UTC](https://forum.inductiveautomation.com/t/power-table-add-blank-row-with-scripted-text-between-a-groups-of-questions-for-a-header/22258/10 "2019-02-05T13:19:07Z")

</div>

This is what I have so far. The only manipulation I am doing right now is adding zero’s to the reading column. but I want to try to put a blank row with a header between each set of question. Where I alternate between grey and white.

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

```auto
def performQuery(aircomp):
	query = "Select b.EquipID,b.Descr, a.QuestionID,a.ReqReading,a.Descr as 'Question', '' as 'Reading', '' as 'Status', '' as 'Comments' from Question(nolock) a join Equip (nolock) b on a.Type = b.Type where b.EquipID in (select EquipID from EquipGrp (nolock) where grp = '" + aircomp + "') order by b.Type, b.EquipID"
	
	
	data = system.db.runQuery(query)
	
	dataset = system.dataset.toDataSet(data)
	
	for i in range(0, dataset.getRowCount()):
		if dataset.getValueAt(i, "ReqReading") == False:
			dataset = system.dataset.setValue(dataset, i, "Reading", "0")
	
	
	return dataset

```
