Forum Discussion
RebeccaEvens-af
2 years agoCommunity Member
Any way to identify a large number of individuals using their user ID and variables?
Hi!
I have a piece of Javascript that brings the learner's User ID (which is a number) into Articulate and saves it as a variable 'UserID'. I have a list of 700 user IDs that need to see a differe...
Jürgen_Schoene_
2 years agoCommunity Member
here a small Javascript, which can do this
var groups = {
1: [
12345678, 12345679, 112345671,
],
2: [
12345699, 12345698, 112345667,
],
// ...
}
var player = GetPlayer();
var userID = parseInt( player.GetVar("UserID") );
var result = 0
for( var group in groups ){
if( groups[group].indexOf(userID) >= 0 ){
result = group;
break;
}
}
player.SetVar("Group", result )
Group = -1 -> not yet searched
Group = 0 -> not found
Group > 0 -> group number
https://360.articulate.com/review/content/aaf27bda-178d-411f-81cd-6d4d96a41724/review