Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
FSternberg
Contributor III
Contributor III

Loading only one csv file each time to sql server (using procedured as attached)

I am using the procedure as attached for load more than one csv file to sql server it is working only for one file of the directory. If I include two files for example in tFixedFlowInput (file_name x table_name) the job seams that it is not identify that exist more than one. 

Could you help me where is the change that I need to do please?

Labels (3)
7 Replies
Anonymous
Not applicable

Hi

What you do on tMap? From your job design, I see tFileInputDelimited only run one time, can you please share a screenshot of tMap and tJavaRow? To iterate each file, replace tIterateToFlow with iterate+tFixedFlowInput

tFileList--iterate--tFixedFlowInput---main--tMap......

 

Regards

Shong

 

FSternberg
Contributor III
Contributor III
Author

Hello, thanks by reply.

I am using the the same example of Talend site (Using Dynamic Schema to load data dynamically to database tables) and the link is as below. https://help.talend.com/r/36FNvH4mND6uL3cKKzTU~w/0niQWjT7eQkj_0HLp57YUA

 

The difference for my project is that I am not using Child Job for the components tFileInputDelimited and  tDBOutput , I created all process in one simple job.

 

Please let me know if you need some information of my job or the project.

 

 

gjeremy1617088143

Hi, you have to do an iteration for each file after your tJavaRow.

Send me love and Kudos

 

FSternberg
Contributor III
Contributor III
Author

Hello, my JavaRow is below and the process in atached. Please, what component need I to use after the JavaRow?

 

context.tablename = out.tablename;

context.filename = out.filename;

FSternberg
Contributor III
Contributor III
Author

Hello, I got to change with child job and worked.

Please, how can I cut the last some characteres from the csv file?

For example, I have the file name DALUNOS_RH_20211222 and I´d like to keep only DALUNOS_RH?

I tried something like below but in the message box show me ever DALUNOS_RH_202

 

((String)globalMap.get("tFileList_1_CURRENT_FILE")).substring(0,((String)globalMap.get("tFileList_1_CURRENT_FILE")).length() - 9)

gjeremy1617088143

for iteration : tFlowtoIterate.

for the file name : ((String)globalMap.get("tFileList_1_CURRENT_FILE")).replaceAll("_\\d{8}","")

FSternberg
Contributor III
Contributor III
Author

Hello please, confirm it for me:

Actual: DALUNOS_RH_20211222.CSV

To be: DALUNOS_RH.CSV

 

How can I to use the command below but keeping the extension .CSV?

 

((String)globalMap.get("tFileList_1_CURRENT_FILE")).replaceAll("_\\d{13}","")