Hi,
Am using Ax 2012. With the help of Random and RandomGenerate class we can create random numbers,but that is not unique. I want the random numbers to be unique. is there any way to achieve it…?
Thanks in advance.
Hi,
Am using Ax 2012. With the help of Random and RandomGenerate class we can create random numbers,but that is not unique. I want the random numbers to be unique. is there any way to achieve it…?
Thanks in advance.
Hi,
Please have a look on the below link
http://axdaily.blogspot.in/2010/01/generating-random-number.html
First Create one Table Name it as RandomTable and Create one Integer Field in this and Name it as Values. Then Try this in ur Jobs.
RandomGenerate r = new RandomGenerate();
RandomTable randomTable, randomTableInsert;
boolean Entry;
int i,counter;
void Generate()
{
i = r.randomInt(1, 40000); // Set the Limit
}
;
do
{
Generate();
select firstOnly randomTable
where randomTable.Values == i;
if (!randomTable)
{
randomTableInsert.Values = i;
randomTableInsert.doInsert();
Entry = true;
break;
}
else
{
Generate();
}
counter++;
if(counter == 10)
{
info(“Increase the Number Limit”);
break;
}
}while (Entry == false);