VL Web - Random Number Generator?

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Quinton
Posts: 2
Joined: Wed Jun 15, 2016 2:50 am

VL Web - Random Number Generator?

Post by Quinton » Wed Jun 15, 2016 3:02 am

Hi!

I have a use for a random number generator in a V14 VL Web application. With the USE command disabled in VL Web, is there an alternative way in VL Web that I can accomplish this?

Thanks!
Quinton

User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: VL Web - Random Number Generator?

Post by Stewart Marshall » Wed Jun 15, 2016 9:22 am

Your only choice in RDML today is to execute a SRVRoutine and generate the number on the server.

Alternatively, you could make a widget with a simple routine that uses the JavaScript Math.random
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au

User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: VL Web - Random Number Generator?

Post by Stewart Marshall » Wed Jun 15, 2016 9:37 am

Out of curiosity, how random does the random number need to be?

The Chicken Chase Game example (xDemoWebChickenChase) uses milliseconds to randomise between 1 and 9. If you're only producing a value every so often and it's based on a user action, this is a fairly reasonable technique.
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au

Post Reply