Forum Discussion
Articulate Storyline: Export to Google Drive
Hello Math Notermans, if we use the score variable, there are many different players, how can we compare their scores and rank them based on the scores they achieved? Thank you Math Notermans!
A great solution to reading and getting data from Storyline is Sheetsrock. This is a Javascript library that makes it a snap to not only read Googlesheets data but also sort and query it. Thus you can target any publicly shared Googlesheet, read it and sort it based on score or whatever and then show the top scorers.
2 things to be aware. Your sheet needs to be publicly shared ( yours is :-)) and you need to show your data in a table. Well not perse show it, but parse it in. As the Storyline tables as is are not easily accessible by Javascript ( due to the fact they are SVG and have no regular HTML-names or IDs ) you have to add a HTML-table.
As you can see in the added Storyline, the data is read into the table.
This code on fill Table shows it like this...$("#googleSheetTable").sheetrock({
url:googleSheet
});
To sort the data into some top scorers order you would need to use Sheetsrock query methods.
It is basically Google query code and you can find all info how to sort and query there.
These lines of code limit the amount of entries processed to 10 ( fetchSize: 10 )
and the query makes sure no 'null' entries are showm and orders ascending.$('#googleSheetTable').sheetrock({
url: googleSheet,
query: "select A,B,C,D,E,F where D is not null order by D",
fetchSize: 10
});
Finally this is the code that gives you a descending list out of all entries.
$('#googleSheetTable').sheetrock({
url: googleSheet,
query: "select A,B,C,D,E,F where D is not null order by D desc",
});
Only thing missing now, is limit the view in the table to only show the top 3 or top 10.
Luckily Sheetsrock is smart and fetchSize does that properly.$('#googleSheetTable').sheetrock({
url: googleSheet,
query: "select A,B,C,D,E,F where D is not null order by D desc",
fetchSize: 10,
});
Well i guess you can tackle this now too :-)
Kind regards,
Math
- doanken12 months agoCommunity Member
Hello Math Notermans, I don't know much about javascript. Currently, the
data sending issues have been resolved. There's only 1 problem left, the
rating column doesn't work, it always shows 0. I don't know where the error
is, please help Math Notermans to look at my attached file, thank you very
much!- MathNotermans-912 months agoCommunity Member
No file attached ;-)
And you apparently edited something on the Google Sheet, as it saves not to the sheet shown before anymore. Sorry cannot help if you keep changing things.