Skip Navigation

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

Ce fil est résolu. Voici une description du problème et la solution proposée.

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 Il y a 4 années et 10 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Ce sujet contient 3 réponses, a 2 voix.

Dernière mise à jour par Jay Il y a 4 années et 10 mois.

Assisté par: Christian Cox.

Auteur
Publications
#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!

Ce ticket est maintenant fermé. Si vous êtes un client de Toolset et que vous avez besoin d'aide, veuillez ouvrir un nouveau ticket d'assistance