Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
LordGrim
Contributor III
Contributor III

Random Winner Script

Hi, I think this will be really simple for those in the know but the easy way eludes me.

Just for fun looking to use a list of ten names (in excel list or inline) and I want too, on a refresh, get a name selected on that list as a random  'Winner'? Only going to schedule for once per month and only for fun.

Any simple load script ideas?

 

Thanks

Labels (1)
1 Solution

Accepted Solutions
DavidM
Partner
Partner

give each name ID from 1 to 10. In script, create a random number, assign it to variable and pick a winner like that:

 

Let vWinner = Ceil(Rand()*10) //this will create a value from 1-10

Then in frontend show Name where it's ID equals the variable vWinner - Only({<ID={$(vWinner)}>}Name)

Winner changes with each reload unless you specify condition

View solution in original post

2 Replies
DavidM
Partner
Partner

give each name ID from 1 to 10. In script, create a random number, assign it to variable and pick a winner like that:

 

Let vWinner = Ceil(Rand()*10) //this will create a value from 1-10

Then in frontend show Name where it's ID equals the variable vWinner - Only({<ID={$(vWinner)}>}Name)

Winner changes with each reload unless you specify condition

View solution in original post

LordGrim
Contributor III
Contributor III
Author

That worked fine - thanks very much