Skip to main content

App Development

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

Announcements
Qlik Cloud Maintenance is scheduled between March 27-30. Visit Qlik Cloud Status page for more details.
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

1 Solution

Accepted Solutions
DavidM
Partner - Creator II
Partner - Creator II

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 - Creator II
Partner - Creator II

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

LordGrim
Contributor III
Contributor III
Author

That worked fine - thanks very much