One Star

[resolved] Sequence Generation

Hi All,
My source is as below ( refer to screenshot which has nulls under C1 column).
My expected output is as below (refer to screenshot which has no nulls).

Kindly assist.
Thanks,
Saty.

Accepted Solutions
Moderator

Re: [resolved] Sequence Generation

Hi id4dsc,
 Numeric.sequence(inputrow.c2,2,1)

janhess's suggestion is pretty good. I upload my screenshots to let you understand it more clearly.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

All Replies
Moderator

Re: [resolved] Sequence Generation

Hi,
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] Sequence Generation

Hi Sabrina,
I have the source as in the screenshot ( refer to screenshot which has nulls under C1 column).
And I didn't get the output. I'm trying to do it in MySQL.. But I want to do it in Talend job itself.
Kindly assist.
Thanks,
Saty.
Moderator

Re: [resolved] Sequence Generation

Hi,
From your expected result screenshot, I have seen the sequence is "2,3,4,5,2,3,4,2,3,4,5,6". Is any rule in it?
You can use component tMap and set a local variable for sequence.
See my screenshots
The expression is:
`Numeric.sequence("s1",2,1)`

Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] Sequence Generation

Hi Sabrina,

 The expression is: `Numeric.sequence("s1",2,1)`

Thanks for the reply. I'm aware of the above expression to generate sequence. But my requirement is as below.

I have 3 unique values under C2 column. If a value under C2 repeats for 4 times then C1 should start from 2,3,4,5.
If another value under C2 repeats for 9 times then C1 should start from 2,3,4,5,6,7,8,9,10 etc,.
I hope u have understood this.
Thnx,
Saty.
One Star

Re: [resolved] Sequence Generation

you have to base your sequence on the value in C2.
Numeric.sequence(inputrow.c2,2,1)
Moderator

Re: [resolved] Sequence Generation

Hi id4dsc,
 Numeric.sequence(inputrow.c2,2,1)

janhess's suggestion is pretty good. I upload my screenshots to let you understand it more clearly.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] Sequence Generation

 Numeric.sequence(inputrow.c2,2,1)

Hi Janhess,
Thanks. It is working.
Hi Sabrina,
I have used above expression in my job and got the output. Thanks for reply.

Thanks,
Saty.
One Star

Re: [resolved] Sequence Generation

Hi,
Please let me know how achieve not equal to condition in Talend?
Ex: Have Table 1 and Table 2 with fileds as field 1 from table 1 and filed 2 from table 2. Now i want to join these tables and check whether table 1.filed 1<> table 2.filed 2.

Please let me know how I can achieve this..
Moderator

Re: [resolved] Sequence Generation

Hi srk08536,
 Ex: Have Table 1 and Table 2 with fileds as field 1 from table 1 and filed 2 from table 2. Now i want to join these tables and check whether table 1.filed 1<> table 2.filed 2.

Did you see the component tMap. You can join two table and set a condition in it.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog