Skip to main content

How to Create a Sequence in Talend

 The sequence routine allows you to create automatically incremented IDs, using a tJava component or any components for example tMap, tFixedFlowInput etc..

The code for defining the sequence is: 

Numeric.sequence("s1",1,1).

whenever you use this sequence Next time, it's value will be incremented by 1.

For Example: following code will print 1,2,3 in a seperate line:

System.out.println(Numeric.sequence("s1",1,1)); 

System.out.println(Numeric.sequence("s1",1,1));

System.out.println(Numeric.sequence("s1",1,1));

if you want your sequence to be printed from specific number, then use that number at the between, the last interger is for the interval.

The following code starts a sequence from 102.

Numeric.sequence("s1",102,1).

Comments

Popular posts from this blog

Convert the Given Date to Any Format

 Suppose you have a date in the format yyyy/MM/DD HH:MM:ss, and you want to convert like DD-MM-yyyy HH:MM:ss. How will you do in Talend. I am going to show you demo. 1. If you want to display the current System date to any format, you can use talend Function as:  TalendDate.getDate("yyyy-MM-dd HH:MM:ss").  This will simply display the current date time in this format. For Example: 2021-09-23 15:09:56 Screenshot: Output of the Above code is: You can use this code whereever you want for example in the tJavaRow, tSetGlobalVar, tFixedFlowInput, tMap components etc... On the similar manner if we have date already given then for converting that date to specific format, first of all you need to parse the date and then give pattern of specific format. For parsing the date there is a function : suppose date = "2018/09/20 12:34:45" for parsing this date,  TalendDate.parseDate("yyyy/MM/DD HH:mm:ss", date); After parsing, you have to format the date using the specifi...