Scenario based Question in Talend???

Seven Stars

Scenario based Question in Talend???

I have CSV file like below

123 145 167
345 567 789


empno ename sal
111 Kiran 200
112. King 300

how to read CSV file from starting header.
Fifteen Stars TRF
Fifteen Stars

Re: Scenario based Question in Talend???

What do you mean?


TRF
Seven Stars

Re: Scenario based Question in Talend???

I want to read CSV file from where header is started.

For example header is in middle of the CSV file
Five Stars

Re: Scenario based Question in Talend???

Capture.PNGyou can read the file like the above

Seven Stars

Re: Scenario based Question in Talend???

No my question is

Header is available in middle of the CSV file I want to read it from there
Five Stars

Re: Scenario based Question in Talend???

If you specify header as 3 in your scenario you can get the values after the header.

 

Seven Stars

Re: Scenario based Question in Talend???

I don't know how many lines available before header then that time how we will do that?
Seven Stars

Re: Scenario based Question in Talend???

Hello,

 

You are not sure about from where the header line will start, probably it could be any number may be 4,5 ..??

 

Regards

Ganshyam

Seven Stars

Re: Scenario based Question in Talend???

How we can find position of header in CSV file
Seven Stars

Re: Scenario based Question in Talend???

Hello,

Below is the data in the csv file where we are not sure about the starting of the header.

 

emp_csv_header.PNG

 

Job Design.

 

header_job.PNG

 

Hope this is the required solution.

Regards

Ganshyam

Seven Stars

Re: Scenario based Question in Talend???

Can you please tell me what the number you given in Header filed in tfileinpitdelimited
Seven Stars

Re: Scenario based Question in Talend???

Hello,

 

I did not specify any number for header,

1) Took one context variable with default values as false.

2) In tjavarow 

   if (input_row.empno.equalsIgnoreCase("empno"))  context.header = true;

3) In tmap : -  !row2.empno.equalsIgnoreCase("empno") && (boolean) context.header

 

Regards

Ganshyam

Five Stars

Re: Scenario based Question in Talend???

Can you please elaborate the scenario
Five Stars

Re: Scenario based Question in Talend???

Can you please elaborate the code that you wrote in tjavarow component
Seven Stars

Re: Scenario based Question in Talend???

Hello,

 

tjavarow.PNG

 

Hope this helps..!!!

Regards

Ganshyam

Five Stars

Re: Scenario based Question in Talend???

Thank you for the response it's worked for me,But im not understanding the code that you wrote can you please explain.
Seven Stars

Re: Scenario based Question in Talend???

I have one more doubt.
How can I write below command in tsystem
For /f "delims=:" %%a in ('findstr /n "cid" "filepath"')
Seven Stars

Re: Scenario based Question in Talend???

As you mentioned on which component we should take context variable default as false .
Where we use this context variable.can you please elaborate explanation
Seven Stars

Re: Scenario based Question in Talend???

And also I want to read header also but in your output there is no header
Seven Stars

Re: Scenario based Question in Talend???

Hello,

 

Define the context variable header under context tab in job design.

 

context.PNG

 

Regards

Ganshyam

 

 

Seven Stars

Re: Scenario based Question in Talend???

Hello,

 

Change the condition in tmap 

tmap.PNG

 

job_design_along_with_header.PNG

 

Hope this solves your purpose..!!!

Regards

Ganshyam

Seven Stars

Re: Scenario based Question in Talend???

I am not getting result.i was just defind columns in output.

What the header value should I give in tfileinpitdelimited
Seven Stars

Re: Scenario based Question in Talend???

It's working perfectly.
Can you please explain how its working.
And what Boolean context header will do
Seven Stars

Re: Scenario based Question in Talend???

Hello,

 

Initially We are setting the value for header as false in context variable.

In tjavarow if condition checks the character if it matches then context variable header is set to true and the same context variable is used in tmap to read the data starting from header value.

 

Hope this clears your doubts..!!

 

Regards

Ganshyam

Seven Stars

Re: Scenario based Question in Talend???

What is the meaning of setting context header to true.

What actually that will do
Seven Stars

Re: Scenario based Question in Talend???

Thanks for your solution.

With the same scenario if I want to process multiple files then how?
Seven Stars

Re: Scenario based Question in Talend???

With the same scenario .
If I want to process multiple Files how to do that?
Seven Stars

Re: Scenario based Question in Talend???

Hello,

 

 

Need to give it  a try..

Meanwhile you can use try using tjava component to write the java code to handle multiple file..

As the existing flow will read only first file and the other files record be as it is...

 

Regards

Ganshyam

Seven Stars

Re: Scenario based Question in Talend???

Can you please tell me how to write Java code to handle multiple files
Seven Stars

Re: Scenario based Question in Talend???

Hello,

 

Please post your exact requirement with screenshot for mutiple file and expected output.

 

Regards

Ganshyam

What’s New for Talend Spring ’19

Join us live for a sneak peek!

Sign up now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch