This blog post is again inspired by a user question, this time in the Linkedin Adobe Captivate discussion group. Here is the question:
"I have 4 simple survey questions in my CP file (5.5). How can I capture the yes/no answers and on another slide lead them down a specific path based on their answers? "
In the past I already answered several questions on forums about storing the user answers in variables so that one is able to create decisions based on those answers, or to show those answers later on. Both goals can be achieved using one Quizzing System variable: cpQuizInfoAnswerChoice.
Play this movie and answer 4 survey questions. Contrary to normal questions, there are not 2 steps, Submit will guide you immediately to the next slide. Based on your answers there is a branching to a Beginner, Intermediate or Expert slide (you'll discover my new garden immigrant on those slides as well). For a first view, I do recommend to show the variables, it is much easier to see what is happening. That is the perfect way to track and debug advanced actions. Have fun.
The system variable is repopulated after each question. To save the answers, it is necessary to use as many user variables as you have answers to store. Since I have 4 survey questions, I created 4 user variables, labeled v_account (first question), v_hashtag, v_chat, v_devices. Because of the choice to show a text caption with the values of the variables, I created another user variable v_view that is set to 1 if the user clicks on the button View variables.
Slides, events and actions
The example has ten slides:
Slide Intro: with the buttons 'No variables' (goes to next slide) and 'View variables' that triggers an advanced standard action ViewVar, very simple (see Gallery). This slide has the text caption TCVariables with the user variables, but its visibility is turned off.TCVariables is timed for the rest of the project.
- Slide Question1: I used the On Enter event of this slide to trigger the advanced conditional action ShowVar (see Gallery) that will show TCVariables if the user choose to. The Else part only has Continue as statement. The Submit button triggers the advanced action Quest1 (see Gallery): it stores the value of cpQuizInfoAnswerChoice in the user variable v_account (corresponding with this slide) and goes to the next slide, thus avoiding the waiting time after the pausing point of the question slide. The answer appears as 'True' or 'False'.
- Slide Question2: the On Enter event triggers a conditional advanced action EnterQuest2 (see Gallery); this action checks the answer stored in v_account. If the user has no Twitter account (v_account has the value 'False'), it has no sense to present the other questions because this user is clearly a Starter. That explains the Jump to Starter slide.
The Submit button triggers the action Quest2 that is similar to Quest2, only the user variable has to be changed from v_account to v_hashtag.
- Slide Question3/Slide Question4: only the actions Quest3 and Quest4 are triggered by the Survey question (executed when the Submit button is pressed), similar action to Quest1, now with user variables v_chat / v_devices.
Slide Decision: this is a very short slide (0,1sec) that will not have been visible to you when playing the project. It was necessary to create this slide because Question slides cannot have a normal On Exit Event. I used the On Enter event of this short slide to trigger the advanced conditional action Decide that will be explained in next part.
- Slide Beginner: I used the On enter event to hide the text caption TCVariables. The Next button jumps to the last slide, End.
- Slide Intermediate: the text caption is hidden by the conditional action Decide, so no advanced action on this slide, the Next button jumps again to slide End.
- Slide Expert: similar to the previous slide, Next button now jumps to the next slide.
- Slide End
This conditional action will branch either to slides Starter, Intermediate or Expert, based on these possibilities for the collected user answers:
- If the user answered positively to all survey questions, I considered him to be an expert. It is however not necessary any more to check the user variable v_account. Due to the previous described action EnterQuest2, we are sure that v_account has the value 'true'. That is the reason why the first decision 'Expert' of the conditional action Decide checks only the value of the variables v_hashtag, v_chat and v_devices. If all these variables have the value 'true', the user will be navigated to the slide Expert and the text caption TCVariables will be hidden as you can see in this screenshot. The option 'All conditions are true' has been chosen, hence the AND in the last column.
- If the user has answered positively on at least 2 questions, I considered him to be an intermediate Twitter user. For the same reason as explained in 1. I am sure about the value 'true' of v_account. That is the reason why I used the option 'Any of the conditions true' in the second decision 'Intermediate' and checked the same 3 variables. The statements are now again hiding the text caption TCVariables and navigation to the slide Intermediate.
If none of those two decisions, conditions result in Yes, only the user variable v_account has the value 'true'. In that case I consider the user still as a starter (he has only created a Twitter account). You do not find a decision for this situation, I just let the play head continue. The slide Decision is just before the slide Beginner, and so the play head will get to that slide automatically. This slide has already the correct setup.
It is also possible to store the user answers in the same way as described, and show those answers in a text caption on a summary slide, or use the answers in a feedback or review caption