
How do I do a count of the number of yes's in yes/no fields
How do I do a count of the number of yes's in yes/no fields
Re:How do I do a count of the number of yes's in yes/no fields
Depends a little where you want to count it.
You use a relationship.
in DQL you can do
retval := Count of MyTable with FieldX=Yes .
If you are to do this in a virtual field you need to define a relationship it can be between the Yes/No field so if it say YES you will get the count of yeses or if it say No you can get the number of Nos.
If it is always to be yes, you need to define a support field that is always yes and use that on one side of the relationship.
Re:Re:How do I do a count of the number of yes's in yes/no fields
Thanks for the prompt response.
This works fine for a virtual field when I have added the support field to the relationship.
I am trying to compile responses from surveys and have 20 different fields i need to have individual yes totals on i a summary form
Re:Re:Re:How do I do a count of the number of yes's in yes/no fields
Then you need 20 relationships if you are doing this in the form.
The support field can be used in all the relationships and then the other side is the individual fields.
You obviously have to use alternate relationship names.
Re:Re:Re:Re:How do I do a count of the number of yes's in yes/no fields
Alternative relationship names works great - Thanks
Re:Re:Re:Re:Re:How do I do a count of the number of yes's in yes/no fields
20 relationships is 'ugly' and the counting can be slow if you have a lot of records...
I would create a hidden integer field with a derivation of 'if( fieldname01 = 'yes', 1 , 0 ) for each of the 20 fields.
Then just do a 'sum of tablename fieldname01'
Only 1 relationship needed