Custom query or script help

I am trying to build a table from two different queries. The first query is:

data = fpmi.db.runQuery("SELECT Count(*) as 'Records', min(t_stamp) as 'Start', max(t_stamp) as 'Stop', max(t_stamp) - min(t_stamp) as 'Duration' FROM L3Log_Treater WHERE OrderNumber = '%f' AND OrderLineNumber = '%d'" % (intOrderNum,intOrderLineNum), "PMI_Line3")I can convert the above to a dataset and bind it to a table.

The second query is

data2 = fpmi.db.runQuery("SELECT DISTINCT RollSequence as 'Rolls' FROM L3Log_Treater WHERE OrderNumber = '%f' AND OrderLineNumber = '%d'" % (intOrderNum,intOrderLineNum), "PMI_Line3")I can convert the above to a dataset and bind it to a table.

This is where the problem is. I am trying to build a dataset by combining the results of the two queries but I am not doing it right.

[code]header = [“Records”, “Start”,“Stop”,“Duration”,“Rolls”]

rowdata= []
rowdata.append(data[0][0])
rowdata.append(data[0][1])
rowdata.append(data[0][2])
rowdata.append(data[0][3])
rowdata.append(len(data2))
event.source.parent.getComponent(‘tbl3’).data = fpmi.dataset.toDataSet(header,rowdata)
[/code]

The other option I tried was to combine both queries but I got stuck since the second query I am looking for the count of distinct rollSequences

Solved.

The mistake I was making is that I was creating a list only when I needed to make a sequence of lists.

Here is the new code:

header = ["Records", "Start","Stop","Duration","Rolls"] rowdata= [] newdata = [] rowdata.append(data[0][0]) rowdata.append(data[0][1]) rowdata.append(data[0][2]) rowdata.append(data[0][3]) rowdata.append(len(data2)) newdata.append(rowdata) event.source.parent.getComponent('tbl1').data = fpmi.dataset.toDataSet(header,newdata)