Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count index values

my input is like

id,col1,col2,col3

101,a,b,a

102,a,a,a

103,b,a,b

My output should be like

101,1,a

101,2,b

101,3,a

102,1,a

102,2,a

102,3,a

103,1,b

103,2,a

103,3,b

 

I have done half part using tnormalize and got the output as

101,a

101,b

101,a

102,a

102,a

102,a

103,b

103,a

103,b

How to get the index count

Labels (3)
8 Replies
TRF
Champion II
Champion II

What's the final expected result?
101,3 (as there is 3 different values for col1)
102,1 (as there only 1 value)
103,2 (as there is 2 values)

What else?
Anonymous
Not applicable
Author

Hi,

 

    Since you have already normalized data, I am not repeating that part. The output from the normalized data can be passed to a tMap to generate the sequence. Please refer the screen **bleep**s below.

0683p000009M80V.png

 

0683p000009M80a.png

 

Numeric.sequence(row1.id,1,1) 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved

Anonymous
Not applicable
Author

My expected output should be like

101,1,a

101,2,b

101,3,a

102,1,a

102,2,a

102,3,a

103,1,b

103,2,a

103,3,b

 

If I have 5 columns for an id I should get 5 rows with the values incremented as 1,2,3,4,5and the respective column value

Anonymous
Not applicable
Author

can we do it in tjavarow?

Anonymous
Not applicable
Author

Well, you can call the function in tJavarow although tMap is my personal favourite.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved

Anonymous
Not applicable
Author

how to do it in tjava..please help. my id is in bigdecimal

Anonymous
Not applicable
Author

Hi,

 

    You can either use tConvertType component to convert the data type from one to another. If you are expert in java, you can directly use Java data type conversion functions.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved