Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
FSternberg
Contributor III
Contributor III

How discard the last 4 characters from file

Hello,

Please, could you confirm if it is correct for discard the last 09 characteres of each file during the identification of them in the directory?

example:

Actual name: integracaonova-22112021

New name: integracaonova

((String)globalMap.get("tFileList_1_CURRENT_FILE")) -9.

Thanks a lot.

Labels (3)
7 Replies
Anonymous
Not applicable

Hello,

Using tFileInputFullRow to read each row one by one, remove or replace the special characters in each row and output it to a new file.

The work flow looks like: tFileInputFullRow-->tJavaRow, where you will put:

row1.myRow.replaceAll("", "");

That should remove anything what is NOT a-z or A-Z or 0-9.

Feel free to let us know if it helps.

Best regards

Sabrina

 

FSternberg
Contributor III
Contributor III
Author

Hello Sabrina, thanks by replay.

I need please remove N characters always in the of End file name but this character can to change.

example felipe12112021

I need. : felipe

eduardo15122022

I need: eduardo

 

FSternberg
Contributor III
Contributor III
Author

I am using tfileList for load Csv files but the files have in his name the date and time at the end and I need to remove when will load.

Anonymous
Not applicable

Hello,

You are trying to rename files?

I'm supposing that you are using a tFileList, so the filename is associated to the variable tFileList_1_CURRENT_FILE. Using a regex you can get what you want for example

globalMap.get(tFileList_1_CURRENT_FILE).replaceAll ("_[0-9]_.*$", ""))

Here is a resolved related topic about: https://community.talend.com/s/question/0D53p00007vCk1DCAS/using-tjava-for-rename-of-current-filenam...

Hope it helps.

Best regards

Sabrina

 

 

FSternberg
Contributor III
Contributor III
Author

Hello,

No, I'm trying only to import some csv's files that have a date at the end of the filename and I need discard this information BEFORE of to use the tFileList component.

I will use the components below to import this csv´s data into different tables in SQL.

How could I just not consider in reading of these files only these characteres at the end of filename?

 

Components I will use:

tFileList, tIterateToFlow,tMap,tFixedFlowInput, tJavaRow, tRunJob

billimmer
Creator III
Creator III

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

FSternberg
Contributor III
Contributor III
Author

Thanks a lot. I will test it