Skip Navigation

[Resolved] Making a simple survey & need some help with creating a view to display results

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to show a View of posts and calculate the total number of posts with each custom field value, like the results of a survey.

Solution: There's nothing built-in to Views that will calculate the total number of posts with a specific custom field value on-the-fly, so the display you described must be built out piece by piece using Views and Views shortcodes. You could use multiple filtered Views to achieve something similar. For example:
- View of submissions filtered by custom field "Question 1", answer "Yes"
- Use the wpv-found-count shortcode to output the number of submissions.

- View of submissions filtered by custom field "Question 1", answer "No"
- Use the wpv-found-count shortcode to output the number of submissions.

- View of submissions filtered by custom field "Question 1", answer "I don't know"
- Use the wpv-found-count shortcode to output the number of submissions.

- A second View of submissions filtered by custom field "Question 1", answer "No"
- In the loop output editor, display the "reason" free-response field

...and so on for each question.

Related documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/#vf-155378

This support ticket is created 5 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by Jay 5 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#1285555

Jay

I am making a simple survey and need some help with creating a view to display results.

I have a CPT with some radio fields and a single line textbox that gets conditionally displayed when a specific option is selected for each set of fields.

For example, my form looks like this:

Question #1
-- Yes
-- No (triggers conditional text field for user to enter "Reason")
-- I don't know

Question #2
-- Yes
-- No (triggers conditional text field for user to enter "Reason")
-- I don't know

Question #3
-- Yes
-- No (triggers conditional text field for user to enter "Reason")
-- I don't know

No problems there. But I would like to create a view to display the results of the submissions that displays like this:

Question #1
Yes (12)
No (3)
I don't know (5)
Reason for voting 'No' entry 1
Reason for voting 'No' entry 2
Reason for voting 'No' entry 3

Question #2
Yes (13)
No (2)
I don't know (5)
Reason for voting 'No' entry 1
Reason for voting 'No' entry 2
Reason for voting 'No' entry 3

Question #3
Yes (11)
No (0)
I don't know (9)

Could anyone give me insight as to how to set up a view to display this?

#1285575

Jay

Sorry, made a mistake, on question #2 view results it should say:

Question #2
Yes (13)
No (2)
I don't know (5)
Reason for voting 'No' entry 1
Reason for voting 'No' entry 2

#1285701

Hi, there's nothing built-in to Views that will calculate the total number of posts with a specific custom field value on-the-fly, so the display you described must be built out piece by piece using Views and Views shortcodes. You could use multiple filtered Views to achieve something similar. For example:
- View of submissions filtered by custom field "Question 1", answer "Yes"
- Use the wpv-found-count shortcode to output the number of submissions: https://toolset.com/documentation/user-guides/views-shortcodes/#vf-155378

- View of submissions filtered by custom field "Question 1", answer "No"
- Use the wpv-found-count shortcode to output the number of submissions: https://toolset.com/documentation/user-guides/views-shortcodes/#vf-155378

- View of submissions filtered by custom field "Question 1", answer "I don't know"
- Use the wpv-found-count shortcode to output the number of submissions: https://toolset.com/documentation/user-guides/views-shortcodes/#vf-155378

- A second View of submissions filtered by custom field "Question 1", answer "No"
- In the loop output editor, display the "reason" free-response field

...and so on for each question.

#1286405

Jay

My issue is resolved now. Thank you!