Six Stars

how to create mate data in talend

Hi Team,

 

I have txt file, i want to load in oracle table. Below is file format. It is possible to create meta data from below file contents in talend.

 

Report:212
date:21-02-2019
------------------------
no name col3
------------------------
02 sanajay sagar
03 xxx yyy

Report:213
date:21-02-2019
------------------------
no name col3
------------------------
05 zxz sa
06 ew qa

 

ID: 121
Row count: 4

 

Thanks

Shree

1 ACCEPTED SOLUTION

Accepted Solutions
Community Manager

Re: how to create mate data in talend

Yes, please test the job flow and accept the post as solution if it fixes your need, it will helps others find helpful answers in the community too!

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
13 REPLIES
Moderator

Re: how to create mate data in talend

Hi,

What does your expected output look like?

In talend, you can centralize file metadata in repository. Here is online document about:TalendHelpCenter:Centralizing File Delimited metadata

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.
Six Stars

Re: how to create mate data in talend

Hi Sabira.

 

Thanks for your input.

 

Please find the attached file.

 

How to create metadata for file, This file is system generated am sharing sample file contents.

 

Thanks

Shree

Moderator

Re: how to create mate data in talend

Hello,

What does your expected output look like?

no;name;col3
02;sanajay;sagar
03;xxx;yyy
05;zxz;sa
06;ew;qa

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.
Six Stars

Re: how to create mate data in talend

Hi Sabira,

 

Yes, Below expected output.

 

no;name;col3
02;sanajay;sagar
03;xxx;yyy
05;zxz;sa
06;ew;qa

 

Kindly suggest how to implement or how to achieve this scenario.

 

Thanks

Shree

Community Manager

Re: how to create mate data in talend

Hi Shree
No a component can be used to extract the data directly from this file. If the format is fixed, I would suggest you to read the file line by line with tFileInputRaw component, then remove the useless lines like starting with "Report", "date", "---", ..., finally, extract the fields with tExtractDelimitedFields, the job looks like:
tFileInputRaw--main--tJavaRow--main--tExtractDelimitedFields--main--tOracleOutput

Hope it helps you!

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Six Stars

Re: how to create mate data in talend

Sure Shong,

 

Let me try as mentioned flow. Let you know if i face any issues.

 

Thanks

Shree

Six Stars

Re: how to create mate data in talend

Hi Shong,

 

Can you give sample example to remove "Report", "date", "---", ..., using tJavaRow. 

 

I don't know java. May be i am asking simple/ silly question here.

 

Thanks

Shree

Community Manager

Re: how to create mate data in talend

Sorry, it was a mistake on my previous post, I meant to use tFileInputFullRow to read the file line by line, and use tFilterRow to remove the useless lines,
tFileInputFullRow--main--tFiterRow--main--tExtractDelimitedFields--tLogRow

on tFilterRow, check the 'use advanced mode' checkbox, and write these Java codes:
(!input_row.line.startsWith("Report"))&&(!input_row.line.startsWith("no name col3"))&&(!input_row.line.startsWith("------"))&&(!input_row.line.startsWith("date"))&&(!input_row.line.startsWith("ID"))&&(!input_row.line.startsWith("Row count"))&&(!input_row.line.startsWith(" "))

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Six Stars

Re: how to create mate data in talend

Hi Shong,

 

No problem,  let me try this code.

 

Thanks

shree

Community Manager

Re: how to create mate data in talend

Yes, please test the job flow and accept the post as solution if it fixes your need, it will helps others find helpful answers in the community too!

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Six Stars

Re: how to create mate data in talend

Sure Shong.

 

Thanks you!.

 

Regards

Shree

Six Stars

Re: how to create mate data in talend

Hi Shong,

 

Awesome, I have tested flow as you mention its working as expected.

 

Small queries, This flow will work source as excel file.

 

Thank you so much.

 

Regards

Shree

Six Stars

Re: how to create mate data in talend

Hi Shong,

 

I tried your flow its worked, i have remove almost unwanted records.

I got some issue the file records after cleaning some data. I have attached 2 records. This file is system generated file.

 

In the each single records split 4 line of code due A4 size width. Half records move to next line.

 

Can you check the line records in notepad++. How to add next line into single lines. Please let me know if you need any information.

 

Thanks Shree