Adding different variables

Use the WorkFlow feature to manage the content review and revision cycles

Moderator: Leif

Adding different variables

Postby maximise » Tue Mar 27, 2012 1:34 pm

Hi, Leif,

I don't know if this is content management or workflow?

I have two small exercises that both separately produce a score%. I then want to pass on to the certificate page where the two compounded scores are then displayed as a final result%.

Is there therefor a simple way of adding the two scores together and /2?
Posts: 41
Joined: Sat Feb 04, 2012 4:09 am

Re: Adding different variables

Postby jmalatino » Tue Mar 27, 2012 2:37 pm

The solution is to create at least two global number variables. Name them "Score 1" and "Score 2".
Then after each quiz push the score into the number variable.

If you used a question set you could have an action like this.
Trigger: Question Set > onComplete
Response: Global Variables > Number > Score 1 > Set Value > Function > Question Set > getScore

And a similar action on the other page pushing that score into the "Score 2" global variable.

On the final page where you want to add the scores you will add them together and divide by two.
You should use another variable to keep everything separated so the learner can go back and try one or both of the quizes again.

Create another global number variable and call it "Score Total".

Then on the final page have the following action.
Trigger: onPageLoad
Response 1: Global Variables > Number > Score Total > setValue > Function > Global Variables > Number > Score 1 > getValue
Response 2: Global Variables > Number > Score Total > add > Function > Global Variables > Number > Score 2 > getValue
Response 3: Global Variables > Number > Score Total > divide > Value > 2
Response 4: Text Object > setText > Function > Global Variables > Number > Score Total > getValue

The above action will add the "Score 1" and "Score 2" variables to the "Score Total" variable and divide by 2. Then it will fill a text box with that value.

This is just the basic way of doing it. There are other more advanced mathematics you can use if you wanted to weight the results of each quiz or wanted the score to be placed inside a longer sentence.
Posts: 71
Joined: Fri Aug 26, 2011 4:03 pm

Return to WorkFlow

Who is online

Users browsing this forum: No registered users and 1 guest

Not able to open ./cache/data_global.php