Row 0 doesn't have the same number of columns as header list error

when i run the above script i am getting this error
Row 0 doesn’t have the same number of columns as header list.
can any one help me out on this

Instead of a screenshot, could you paste the code here? Also, what version of Ignition are you using?

In your code, data only has one element which is the array you appended in line 9. You need to append x1-x5 in their own append statements.
Alternatively, I think it would work if you use .extend() instead of .append() on line 9.
@Paullys50 is correct. Not sure what I was thinking. Like he said you should try validating the tag reads or use system.tag.readBlocking()

OP's syntax is acceptable.

headers = ["Label", "Compressor", "Line", "Services", "SPA"]
data = []
x2 = 2
x3 = 3
x4 = 4
x5 = 5
data.append(["workshop", x2, x3, x4, x5])

event_perform = system.dataset.toDataSet(headers, data)
print event_perform

One or more of the system.tag.read calls is likely returning an empty or invalid value that is causing the conflict. Easy to verify if you comment out the reads and replace with a value per my example. If I'm correct you will need to validate the x2-x5 values after the read but prior to adding them to the data array so they are initialized with some default should the tag read result not provide good data.

2 Likes

@Paullys50 Thanks this post was very helpful to me.