Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Random number genaration

Hi,
I am new to Talend, I am working on open studio tool, I would like to generate a number with in the numbers.
The number are starting from 0000 to 9999, with in the number find out the not in sequence number and generate the new number, it is in DB2. Please help me out.
Thank you,
Praveen
Labels (2)
3 Replies
Anonymous
Not applicable
Author

Hi
for this you can use random number generator in java
java.util.Random (package)
// for generating random number for the range b\w 0000 to 9999
int randomInt = randomGenerator.nextInt(9999)
Anonymous
Not applicable
Author

Thank you - Lijo,
And I have one more question about on the same scenario, I would like to check the available numbers ( 0000 to 9999 ), If not available number in between ( 0000 to 9999 ) generate the new number. Could you please help me out?
Thank you,
Praveen
Anonymous
Not applicable
Author

Hi Praveen
Are you storing to numbers in the database?, if yes you can put a query else
you can save the numbers to an arraylist and then check if it contains
boolean blnFound = arrayList.contains("2")
Hope it helps you