• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » reference other rows in a job

#1 2012-06-13 10:06:06

MarWestermann
New member
Registered: 2012-05-03
Posts: 4

reference other rows in a job

Hi, I have a complex problem which I have to solve using talend. I have a source table with product groups which look like:

ID | Description | Parent-ID
1 | Men|
2 | Women|
3 | Jeans | 1
4 | slim | 3
5 | Jeans | 2
6 | regular | 5

Now I have to change the description on the basis of the parent ID so I have the complete path of the group like this:

1 | Men
2 | Women
3 | Men / Jeans
4 | Men / Jeans / slim
5 | Women / Jeans
6 | Women / Jeans / regular

Does anyone know how I can archive this?

Thank you very much for every hints you give.

best regards Marco

Offline

#2 2012-06-13 10:13:41

janhess
Member
Company: Newcastle University
Registered: 2009-05-19
Posts: 1137

Re: reference other rows in a job

There's no way to determine that row 6 is related to women until you've built a partial relationship. Looks like it may need to be a multi stage process.

Offline

#3 2012-06-14 12:41:03

MarWestermann
New member
Registered: 2012-05-03
Posts: 4

Re: reference other rows in a job

Hi thank you much for your hints.

But how could this multi stage process look like?

What I could imagine but are not familiar with is to read all the lines into an array or something like that and use my own java code to iterate over that array and change the description of the groups. Would that be a way and if yes how would the transformation look like?

regards, Marco

Offline

#4 2012-06-14 15:44:58

mpa
Member
Company: Thinking Solutions
Registered: 2010-12-17
Posts: 257
Website

Re: reference other rows in a job

I think you should have a look at "recursive queries".

For example the following url:
http://database-programmer.blogspot.be/ … table.html

Regards

Offline

#5 2012-06-14 16:21:04

MarWestermann
New member
Registered: 2012-05-03
Posts: 4

Re: reference other rows in a job

@mpa: Thank you. That looks very interesting! Sadly my DB doesnt support that! Any other suggestions? what is with my proposal to write a java code which iterates over an array with the datasets and directly manipulating the fields?

regards Marco

Offline

#6 2012-06-15 16:53:06

MarWestermann
New member
Registered: 2012-05-03
Posts: 4

Re: reference other rows in a job

Ok, seems, that I've found a solution.

I send the datasets from my sql table to a tBufferOut. OnComponentOk I use a tJavaFlex to change the descriptions within the buffer. OnComponentOk I use a tBufferIn and write my changed datasets to a file.

regards, Marco

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » reference other rows in a job

Board footer

Powered by FluxBB