Skip to main content
JayC_in_WV
Inspiring
March 10, 2020
Answered

Assign a Variable Value in a Share Action

  • March 10, 2020
  • 5 replies
  • 707 views

This one is aimed a Lilybiri...you've sold me on Shared Actions, but, I ran into a problem.

I setup a shared action to change the state of a couple of objects when learners select different buttons on the page.  But, I need a variable to update as well so I can keep track of what button has been selected.  Everything works fine EXCEPT the "Assign" option doesn't come up in the shared action so I can't change the variable value.

 

Is there another command I should use in a shared action or do you have a workaround for this?

 

jay

    This topic has been closed for replies.
    Correct answer Lilybiri

    It is not a Boolean. This is a tricky situation. I would have preferred Booleans for a shared action, one Boolean for each button is much safer. In that case you could have defined the variable as parameter. You can try to define the literal as parameter, but that needs a lot of testing, because you have another literal in the action, which is the waiting time. It can perfectly be done (also your next advanced or shared action) with Booleans instead of one variable to track the selection. 

    I have some posts explaining the difference between a 'compulsory' parameter and a 'candidate' parameter. Both variables and literals are 'candidate'.

    5 replies

    Lilybiri
    Legend
    March 10, 2020

    Can you show me the advanced action and the parameters dialog box?  You probably didn't indicate the variable as a parameter. Is it a Boolean?

    JayC_in_WV
    Inspiring
    March 10, 2020

    Here you go.

    Shared Action:

    Create From Shared Action:

    The object of this action is that the learner has to choose the correction option amongst four choices.  Selecting a choice displays information about that choice.  There is another button that the learner select to make their choice...which is where the variable value comes in.  This second button executes an advanced action that checks the variable value and then displays the appropriate feedback.

     

    Thanks for the help.

    Jay

    Lilybiri
    LilybiriCorrect answer
    Legend
    March 10, 2020

    It is not a Boolean. This is a tricky situation. I would have preferred Booleans for a shared action, one Boolean for each button is much safer. In that case you could have defined the variable as parameter. You can try to define the literal as parameter, but that needs a lot of testing, because you have another literal in the action, which is the waiting time. It can perfectly be done (also your next advanced or shared action) with Booleans instead of one variable to track the selection. 

    I have some posts explaining the difference between a 'compulsory' parameter and a 'candidate' parameter. Both variables and literals are 'candidate'.