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

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

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

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

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.

the data set comes from a sql query

Have you tried using the Treeview?

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.

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?

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().

1 Like

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.

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