Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Tmap generating sequence number

 I am working on generating multiple excel output files and using numeric sequence in Tmap to generate sequence numbers. The sequence number for these records should be same across all the sheets.

 

e.g.,One of the output sheets is a phone numbers sheet and there are 10 records and some of them do not have phone numbers and are null.

 

So, I used tfilterRow to remove the null values and only pass the records which have phone numbers. The problem here is, the Sequence number that is generated for this Sheet is not the same as previous sheets.

 

For E.g., There are 10 customers and say 3,6 and 9 do not have a phone number, the sequence should generate as

Phone1

Phone2

Phone4

Phone5

Phone7, Phone8 and Phone10.

 

Instead the Talend is generating a sequence Phone1,2,3,4,5,6,7 etc.

 

I need a solution where the sequence number is not effected by the null records. If there is a null record, skip it and generate the next sequence number.

 

Thanks 

SK

Labels (2)
4 Replies
Jesperrekuh
Specialist
Specialist

in tMap:
if row1.phonenumber == null ? null : sequencefunction()
Anonymous
Not applicable
Author

I think you can try generating your sequence numbers and associating them before removing the null values.

In my opinion that should work, otherwise i don't have any other idea right now.

aashish_21nov
Creator
Creator

you can generate a sequence in tmap itself and then use tfilterrow. So, your job should be like:

 

tmap with fields (phone_number,numeric.sequence("s1",1,1)) --> tfilterrow 

SachinD
Creator
Creator

Create Variable in tMap

 

row4.Mobile == null || row4.Mobile.equals("") ? 0 : Numeric.sequence("s2",1,1) 

 

Thanks,

Sachin