26
Views
1
Comments
Solved
auto random number for 6 digit in JavaScript

i want to generate 6 digit from randomize numbers and assign to local variable in out system without using any forge how i can ?

2024-06-30 04-29-36
Priya Jhode
Solution

Hello, @moheman aldulimy 

You can refer this thread also:  https://www.outsystems.com/forums/discussion/86671/how-to-generate-random-alphanumeric-numbers-and-store-then-in-database/#Post366438 


you want to generate a random string of length of your choice in JavaScript. In that case, you can add a JavaScript node with the following code and and an input parameter TextLengthnof type integer and an output parameter of type text called Uid to it. 

function getRandomString(length) { 

 var s = '';  

do { s += Math.random().toString(36).substr(2); } while (s.length < length);  

s = s.substr(0, length);    

return s;

}

$parameters.Uid = getRandomString($parameters.TextLength);


hope, this will helps you.

Thanks & Regards

-- Priya Jhode

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.