Count Specific Yes/No fields per Record

xyba

Registered User.
Local time
Today, 20:33
Joined
Jan 28, 2016
Messages
189
In a table each record has a set of 12 checkboxes for recording different types of issues.

In a report, I want a field within the main body of the report that is a count of how many issues (checkbox checked) for each record.

Can anyone give any advice please?
 
Problem begins with inappropriate data structure. The fields for the checkboxes should be in a related table where they are easily counted by the database engine grouped by the PK of the records.
 
living with your non normalised data means queries and calculations are more complex, more unwieldy and more frequently need to be modified to accommodate changes.

But to answer your question something like

abs(cb1+cb2+cb3....)

will tell you how many checkboxes are ticked and assumes none are set to triple state
 
Thanks for the advice from all above. I understand the normalisation issue but this db is very small and is unlikely to expand so a single table is sufficient for the purpose, though I do take on board your comments.

CJ - Your solution worked as required. Thanks.
 

Users who are viewing this thread

Back
Top Bottom