Skip to main content
Participant
December 22, 2017
Answered

Setting Advanced Actions (Conditional Actions) for multiple items to be selected

  • December 22, 2017
  • 1 reply
  • 498 views

Hello,

I'm trying to look for an answer on how to create Advanced Actions for the scenario below.

Scenario: User must select 5 items (SmartShapes) out of 12 before a SmartShape (Keep in Mind) appears.

What will be the conditional statement for this to work?

Thanks in advance.

    This topic has been closed for replies.
    Correct answer Lilybiri

    Liliybiri has raised an excellent point.

    Since it might be possible for the user to click multiple times on the same button and increment the tracking variable without selecting different items, your Conditional Action would need to first perform a check to see if the boolean variable for the specific object has a value of 0, and only if that is TRUE then increment the tracking variable and assign the Boolean to 1.

    So you definitely DO need a variable for each object as well as a tracking variable.


    Yes, Rod that is another way of solving it. In the previous thread I suggested summarizing the individual Booleans, but the user had only 4 interactive objects. Second reason was that it seemed easier to explain and understand because the user was pretty new to advanced actions. May I list up the three possibilities?

    1. If the user is allowed to click only once on a button, and you don't need to remember which buttons have been clicked, only a counter is necessary. When incrementing that counter, you disable the button that has just been clicked, thus avoiding that it can be clciked again. The second decision will check the value of the counter. This is the most simple solution.
    2. If the user is allowed to click each button multiple times, you need both the counter and the individual Booleans. To avoid incrementing the counter by a click on a button that has already been clicked, you calculate the counter by summarizing all the Booleans. Cumbersome with advanced actions if you have a lot of buttons because each Expression command can only use two terms. That is why I suggested using a JS math function.
    3. Your last proposal: add a decision (probably- that is conditional and increments the counter only when the Boolean for that button is still set to 0.

    1 reply

    RodWard
    Community Expert
    Community Expert
    December 22, 2017

    It's not just going to require a Conditional Action.

    You will need to have a User Variable that tracks the number of items that have already been selected.

    You haven't indicated HOW you intend to show that each of the items are currently selected or have been previously selected.  Will this be done with Object States or some other method? If clicking the item will also create some visual clue that this particular item is selected then each Smart Shape will need to trigger a separate Conditional Action.

    The Conditional Action will first increment the User Variable that tracks the number of items so far selected, and perform whatever other action will indicate selection.  Then it also needs a Decision Block that checks the value of the tracking variable to find out if it has reached 5, and if so, then perform the SHOW action that displays the Keep in Mind box.

    Participant
    December 22, 2017

    Thanks for responding quickly.

    I've already created User Variables for each of the items with a value of 0. Also, when these items are selected the colors will change to green. I created an Object State View (Clicked) for that and made changes to the Actions setting (Change State to Clicked).

    That's what I have so far.

    RodWard
    Community Expert
    Community Expert
    December 22, 2017

    You're still going to need a separate variable to track the actual NUMBER of times an object has been selected.  Just using the separate variables for each object doesn't really help you in that respect (though separate variables might be necessary if you need certain things to happen based on WHICH specific items have been selected).