# How to create a ranked list using numeric variables?

Hello, I have created a quiz that goes through 15 questions, however, instead of assigning a value to answers based on being "correct" or "incorrect", each possible answer (some questions have two options, others have four) adds value towards one or more of 36 other variables. So, at the end of the quiz, each variable could have a value ranging from 0 to 5 so there is lots of potential for variables to end up equal to or in very close range to each other. What I need to do now is create a graphic with a ranked list of the top 6 variables. I have done this in the past with only a few variables by changing the state of an image using triggers that say,

"Change state to #1 If A is equal to or greater than B AND A is equal to or greater than C AND A is equal to or greater than D AND A is equal to or greater than E"

then the second place spot would be, "Change state to #2 If A is equal to or less than B AND A is equal to or greater than C AND A is equal to or greater than D AND A is equal to or greater than E",

plus "Change state to #2 If A is equal to or greater than B AND A is equal to or less than C AND A is equal to or greater than D AND A is equal to or greater than E",

plus "Change state to #2 If A is equal to or greater than B AND A is equal to or greater than C AND A is equal to or less than D AND A is equal to or greater than E",

plus "Change state to #2 If A is equal to or greater than B AND A is equal to or greater than C AND A is equal to or greater than D AND A is equal to or less than E".

So that is only ranking the top 2 spots for variable A only, and with only 5 possible variables. I have 6 possible spots with 36 possible variables which is pretty easy math-wise to rank them from highest to lowest but involves incredibly hard and time-consuming triggers to put in place! I am very experienced and competent in Storyline but I'm hoping that I'm just missing something easy and obvious because the shear scope of this is making my stomach hurt! :-(

Does anyone have any brilliant suggestions? Thank you very much in advance!

###### 8 Replies

I forgot to mention that this is rather urgent!

It should be such a simple thing - ranking a list from the highest value to the lowest. Why on earth would this be so hard in Storyline????? I can't possibly be the first person who has ever had to do this with more than a few variables! I have tried doing a Google search for forum threads on this because the forum's search function does not work but I can't find anything of use at all. I am definitely going to submit this as a function request if it can't be done currently because this seems really silly to have it be this obscenely complicated to do what is, literally, one click in in Excel.

Hi Mel,

Unfortunately I haven't come across a simpler way of achieving this but i did want to highlight one point - after the first place spot has been taken you'll need to add a condition to the remaining spots that will also account for that option already being in the list.

ie change spot 2 to orange if var = and if spot 1 is not = to orange (can you tell I'm building something orange at the moment...)

You may have already thought of this, but I certainly didn't when I had to do something similar and fixing this error afterwards took me ages.

I'd also suggest testing very often as small mistakes easily creep in with this type of activity.

Sorry I can't be of more help

Harri

Mel,

If your project does not need to be deployed in the Articulate Mobile Player app, I recommend using JavaScript to do this. Using JavaScript, you can place each value in an array and use the 'sort' function to arrange the numeric values from highest to lowest.

@Harri - Yes, I have done this several times before so I have had to work that out. I guess I didn't entirely demonstrate that in my example but I am painfully aware of the number of triggers necessary to create that, even with only a few variables to rank. When it gets into the number that I am dealing with, I start to feel really defeated. :-(

@ Steve - I do not know Javascript at all but I did look into that option just until I discovered that it does not work on the iPad app as that is going to be the main method of delivery in this case so it does not help me much. I would not have any idea how to write that code anyway and it is not included in the list of suggested code that Articulate provides, so I'm not sure where I would get that code even if I were able to use it.

I just can't believe that this is something that no one has ever had to do in Storyline before! Mine is the only forum thread that comes up when I do a search for "ranked list using variables" or any other variation that I could think of.

Mel,

A couple of questions:

1. Are the values of the variables always going to be whole numbers or could they end up being, say, "2.5" or "4.7"?

2. What happens when more than one variable has the same value? It sounds like it could theoretically be possible for the top six variables to all have the same value.

Off the top of my head, I think this can be done with 216 triggers (36 variables x 6 possible values), which, in the scheme of things, is not that many would be quickly duplicated and modified.

If you're permitted to share with me via a private message just that portion of your project, I'd be happy to take a look.

Hi Mel,

I sent you the details via PM. Attached is a .story file that presents one way to do this.

I'll try attaching the file this time .