# Data Collection Errors

**URL:** <https://forum.inductiveautomation.com/t/data-collection-errors/20330>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [October 23, 2018, 7:03pm UTC](https://forum.inductiveautomation.com/t/data-collection-errors/20330 "2018-10-23T19:03:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![WChester](https://avatars.discourse-cdn.com/v4/letter/w/df788c/32.png) [@WChester](https://forum.inductiveautomation.com/u/WChester)\
**Post date:** [October 23, 2018, 7:03pm UTC](https://forum.inductiveautomation.com/t/data-collection-errors/20330/1 "2018-10-23T19:03:04Z")

</div>

I am sure this is an easy fix, but I’ve just started using the report module and when I try and use a table I keep getting a data collection error : Wrong number of vaules for a row. Expected 4. I cannot provide the query I am using for the source but it is like this  
select count(table.part\_sn) as ‘Count’,  
part\_status as ‘Status’,  
check\_description as ‘Check’,  
check\_type,  
design as ‘Design’  
from table

---

<div class="post-metadata">

**Author:** ![ethomason](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ethomason/32/43338_2.png) [@ethomason](https://forum.inductiveautomation.com/u/ethomason)\
**Post date:** [October 23, 2018, 7:48pm UTC](https://forum.inductiveautomation.com/t/data-collection-errors/20330/2 "2018-10-23T19:48:08Z")

</div>

Does this query work outside of the reporting module? I don’t think it will. You are selecting the count, which will return 1 result, and then individual values, which will return many results.

---

<div class="post-metadata">

**Author:** ![WChester](https://avatars.discourse-cdn.com/v4/letter/w/df788c/32.png) [@WChester](https://forum.inductiveautomation.com/u/WChester)\
**Post date:** [October 29, 2018, 9:00pm UTC](https://forum.inductiveautomation.com/t/data-collection-errors/20330/3 "2018-10-29T21:00:04Z")

</div>

Actually it does work when I include the group statement. I don’t know why this caused the data collection error though.  
I ended up using something like this:  
SELECT design as 'Design ‘,  
test\_running as ‘Test’ ,  
config as ‘Part Config’,  
count(\*) as ‘Total’,  
count(case  
when status=‘WIP’  
then 1  
else null  
end) as ‘In Test’,  
count(case  
when status=‘Pass’  
then 1  
else null  
end) as ‘Pass’,  
count(case  
when status=‘Fail’  
then 1  
else null  
end) as ‘Fail’,  
count(case  
when status’=‘Hold’  
then 1  
else null  
end) as ‘Waiting’

from inventory  
where test is not null  
group by design,test,config  
And this is working like I need it.
