Skip to main content
Participant
January 26, 2017
Answered

Why is my simple +1 expression not working? (Cap. 8)

  • January 26, 2017
  • 3 replies
  • 413 views

HI! I'm new to using variables in Captivate 8 and am trying to ensure a user has clicked on all 6 buttons on a single page before they're allowed to continue to the next slide.

  • I created my variable (BPViewAll)
    • Set it to 0

  • I created an advanced action to hide the next button based on the count:
    • BPViewall Greater Than or Equal to 6 then Show Next Else Hide Next

  • I set all 6 of my buttons with the advanced action:
    • Expression = BPViewall=BPViewall+1
    • (I also tried usining increment BPViewall by 1)

Neither of these are increasing the count.

I can see the slide on enter advanced action is working because the next button is hidden, but no matter how many times I click on all the boxes the count never seems to get high enough to show.

Please advise, thanks!

This topic has been closed for replies.
Correct answer Lilybiri

This is what will solve your problems. You can use the On Enter action to reset the counter to 0 and to hide the Next button. However the incrementing and the checking of the counter has to be done with the action triggered by clicking the buttons.

I need some more details before offering you the setup of the actions for the buttons. Do you allow the user to click multiple times on the same button? In that case you'll not be able to solve this with one user variable but you'll need a user variable for each button. If you don't allow multiple clicks on each button it can be done with one counter variable., this way:

Create a conditional advanced action with two decisions

First decision 'Always' is a mimicked standard action because the condition is always trye

  IF 1 is equal to 1

        Increment v_counter by 1

        other commands...

Second decision 'Checking'

  IF v_counter is equal to 6

       Show Bt_Continue

       Enable Bt_Continue

If you allow multiple clicks, you have to define one (Boolean) variable for each button, with a default value of 0. You'll have a slightly different action for each, also conditional with two decisions, similar setup:

First decision 'Always' is a mimicked standard action because the condition is always trye

  IF 1 is equal to 1

     Assign v_one with 1              this variable will be different for each button

    ​Disable Bt_One

    other commands...

Second decision 'Checking'

  IF v_one is equal to 1   AND

      v_two is equal to 1   AND...

      v_six is equal to 1

        Show Bt_Continue

         Enable Bt_Continue

3 replies

Participant
January 30, 2017

This worked great. Thank you so much. I finally was able to loop back to this project and completely understood.

I understood that the action I had assigned to the slide on enter --- check variable and show/hide next button --- was only running one time (on enter) and never checked again after all the buttons had been clicked to show or hide the button accordingly.

I fixed this by making all 6 of my buttons 2 part conditional actions -

part 1 - Check Variable, if greater than or equal to 5 (number of buttons) then show Next Button, else hide Next Button 

part 2 - Show pop up (I just copy/pasted the actions I originally had in my standard action to show the correct pop up and hide all others). I added to this the action Increment variable by 1. And to ensure these actions happen on click no matter what I set the conditional piece to If variable is greater than or equal to 0.

I had never used the side by side conditional action thing before, but it wasn't too difficult and I was able to recreate all 6 of my buttons in less than 30 minutes. Now it works great.

Thanks all for your insights! Much appreciated

Lilybiri
LilybiriCorrect answer
Legend
January 26, 2017

This is what will solve your problems. You can use the On Enter action to reset the counter to 0 and to hide the Next button. However the incrementing and the checking of the counter has to be done with the action triggered by clicking the buttons.

I need some more details before offering you the setup of the actions for the buttons. Do you allow the user to click multiple times on the same button? In that case you'll not be able to solve this with one user variable but you'll need a user variable for each button. If you don't allow multiple clicks on each button it can be done with one counter variable., this way:

Create a conditional advanced action with two decisions

First decision 'Always' is a mimicked standard action because the condition is always trye

  IF 1 is equal to 1

        Increment v_counter by 1

        other commands...

Second decision 'Checking'

  IF v_counter is equal to 6

       Show Bt_Continue

       Enable Bt_Continue

If you allow multiple clicks, you have to define one (Boolean) variable for each button, with a default value of 0. You'll have a slightly different action for each, also conditional with two decisions, similar setup:

First decision 'Always' is a mimicked standard action because the condition is always trye

  IF 1 is equal to 1

     Assign v_one with 1              this variable will be different for each button

    ​Disable Bt_One

    other commands...

Second decision 'Checking'

  IF v_one is equal to 1   AND

      v_two is equal to 1   AND...

      v_six is equal to 1

        Show Bt_Continue

         Enable Bt_Continue

Participant
January 26, 2017

This looks great! Thank  you so much!

It is currently set up with no limitation on the number of times users can click on each button. They each contain information for them to learn.  I want to ensure they click on all 6 at least once, but if they want to go back and read one again, that is fine.

So it sounds like I need to try the multiple click option. I will do so soon and report back. Thanks again!

Lilybiri
Legend
January 26, 2017

Advanced/shared acions in Captivate are always event driven. The events are limited, you can find a list in this blog post:

http://blog.lilybiri.com/events-and-advanced-actions

Todd_Spargo
Participating Frequently
January 26, 2017

Your Advance Action (AA) is triggering only once...on enter.  The variable isn't checked after that. You should craft an AA that checks the variable then takes action every time the buttons are clicked.

Participant
January 26, 2017

Super helpful! Thank you. So what would I need to add to the button AA scripts which would make it check on the BPViewAll variable (and show the next button accordingly)? I don't see the option to execute an advanced action from within an advanced action, so I'm not sure how to make it do this.

Todd_Spargo
Participating Frequently
January 26, 2017

See Lilybiri's reply for a better explanation.