HAY GUYS
I FOUND THIS CODE FOR GENERATING AUTOMATIC NUMBER AT ANY SPECIFIED FIELD
POSTED BY MR.JONO MOORE
______________________________
MY QUESTION IS,
CAN I MAKE A BUTTON THAT ABLE TO REFRESH THAT CODE IN THE FIELD
SO I CAN GENERATE A NEW NUMBER EVERY TIME I PRESS THAT BUTTON ?
THEX ALOT ,,,
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
Please note SHOUTING does not help.
Using the code above you could easily modify that to generate a number on a button click but removing the if from the code and placing this on a button click and assigning it to a field;
var d = new Date();
fieldName.rawValue = Math.floor (d/1000);
however as John stated this does not actually give you a random number as it relies on a date and could in theory result in the same number at some point so I would use
fieldName.rawValue = Math.floor(Math.random()*11); // this would give a random number between 0 and 10, if you want it in a different limit change 11 to something else.
Hope this helps
Malcolm
Views
Replies
Total Likes
Hi,
Please note SHOUTING does not help.
Using the code above you could easily modify that to generate a number on a button click but removing the if from the code and placing this on a button click and assigning it to a field;
var d = new Date();
fieldName.rawValue = Math.floor (d/1000);
however as John stated this does not actually give you a random number as it relies on a date and could in theory result in the same number at some point so I would use
fieldName.rawValue = Math.floor(Math.random()*11); // this would give a random number between 0 and 10, if you want it in a different limit change 11 to something else.
Hope this helps
Malcolm
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies