Using ws_form_stat to Show Submission Statistics

When asking questions in a form using choice fields such as select, checkbox or radio fields you may wish to obtain statistics about the answers given. You can use the ws_form_stat shortcode to do this.

Demo

Form Statistics

Total Responses: 203

Early bird: 105 (52%) Night owl: 98 (48%)

Usage

The ws_form_stat shortcode can contain the following attributes:

AttributeDescriptionDefault
field_idThe field ID you wish to obtain statistics for.
typeChoose count or percent.
valueOptionally enter a value you would like to obtain statistics for.
decimalsNumber of decimals to include in the returned statistic.0
thousand_separatorThe character to use as the thousand separator.,
decimal_separatorThe character to use as the decimal separator..

Examples

ShortcodeDescriptionExample
[ws_form_stat field_id="123" type="count"]Return the total number of submissions for field ID 123.203
[ws_form_stat field_id="123" type="count" value="Early bird"]Return the total number of submissions for field ID 123 that chose the value “Early bird”.105
[ws_form_stat field_id="123" type="percent" value="Early bird"]Return the percent of submissions for field ID 123 that chose the value “Early bird”.52%
[ws_form_stat field_id="123" type="percent" value="Early bird" decimal="2"]Return the percent of submissions for field ID 123 that chose the value “Early bird” to 2 decimal places.51.72%