Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Want to create random numbers on clicking a button.
Example :
clicking a button produce a number '3' and clicking the same button again produce another number '7' and so on.within the limit of 20.
Kindly awaiting for your response
Regards,
Dinesh M
May be use a piece of macro
sub Random
set vRand = ActiveDocument.GetVariable("vRand")
x= rnd*20
vRand.setContent x,True
End sub
Maybe create an External - Set Variable action in the button properties and set a variable value to
=Ceil(RAND()*20)
Maybe this is helpful: Re: Generate 6 different random numbers
- Marcus
Do you know why it wouldn't work for me in the attached file. Seems like the value for Rand() just doesn't want to change
It's weird but maybe it only recalculates when something changes?
I changed it to rand*now() and clicking the button does then work
Seems like some kind of caching is kicking in.
We may need to force Qlik to reevaluate the expression:
=Ceil(RAND()*100) +0*Now(1)
(Sometimes it takes more than 1 click to change)
May be use a piece of macro
sub Random
set vRand = ActiveDocument.GetVariable("vRand")
x= rnd*20
vRand.setContent x,True
End sub
Ya Sunny on button click it will not change.It will change only on reload.
Thank you.
Thanks you Stefan it is working as you said it takes more that one click sometimes .
Any other method to change the value on one click.
Thank you Sasidhar. It is working.