Six Stars

Management of processing file

Hello,

 

I have an issue of a technical process and I don't find a solution on the web.

 

The issue :

 

I have a folder including numerous DAT files in the format CSV, however all are not useful for me. For that purpose, I wish to read a case (cell) of these (all have the same formatting) then according to the result. I decide or not to copy this file somewhere else with the same name.

 

File example :

 

Name: 2015-07-06 Seq_001

 

Date=06072015_174419

Plage= 1000Hz à 10000Hz

Climat = Froid

Commentaire = Commentaire

 

Information…

 

 

They are 3 types of climat : Climat  = Chaud or Climat = Ambiant, and it's this case that I want to see.

 

Solution  :

tFileList

  Directory: « D:/_users/BMI/Test »

  « *.csv »

tFileDelimited

  Flow's name : ((String)globalMap.get(“tFile_CURRENT_FILEPATH »)).

 

I don't find any idea for the contuation, can you help me ?

While waiting, I continue to search.

 

Best regards

BastienM

  • Data Integration
1 ACCEPTED SOLUTION

Accepted Solutions
Nine Stars TRF
Nine Stars

Re: Management of processing file

You're welcome.
Don't forget to mark the topic as solved if it is (for people searching for the same subject).
Kudos also accepted!

TRF
6 REPLIES
Nine Stars TRF
Nine Stars

Re: Management of processing file

Hi Bastien,

 

Configure the tFileInputDelimited like this to read only the 3rd line:

- Field separator = "="

- Header = 2

- Limit = 1

Set the schema as FieldName string and FieldValue string.

Add a tFilterRow after tFileInputDelimited and configure it like this:

Capture.PNG

Connect tFilterRow to tLogRow to see the result, you should receive only the desired records.

Hope this helps.

 

 


TRF
Six Stars

Re: Management of processing file

Hi TRF,

 

Actually, I want to check this result, but my final aim is to copy this file with the same name with tFileCopy or an another component.

So, how I can access at this achievement with the result of tFilterRow.

 

Best regards

BastienM

Nine Stars TRF
Nine Stars

Re: Management of processing file

Connect tFileCopy to tFilterRow using a "If" trigger like this:

Capture.PNG

and write the condition like this:

((Integer)globalMap.get("tFilterRow_1_NB_LINE_OK")) > 0

 The copy will apply only if 1 record is equal to "Ambiant".


TRF
Six Stars

Re: Management of processing file

Hello,

 

I don't understand the usage of the component tFixedFlow because it haven't directory, so I used this solution :

 

tFileList_1 :

Directory : "D:/_users/BMI/test"

Files : "*.dat"

 

tFileInputDelimitedt_1 :

Flow's name :

((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))

 

tFilterRow_1 :

column0          Vide           Vaut            "Climat = Froid"

 

IF :

Condition :

((Interger)globalMap.get("tFilterRow_1_NB_LINE_OK")) > 0

tFileCopy_1 :

File's name :

((String)globalMap.get("tFileDelimited_1_CURRENT_FILEPATH"))

Directory : "D:/_users/BMI/test2"

 

However, when I execute my job, I have the message :

Démarrage du job experience a 13:25 24/07/2017.
[statistics] connecting to socket on port 3545
[statistics] connected
Exception in component tFileCopy_1
java.lang.NullPointerException
	at java.io.File.<init>(Unknown Source)
	at freqnum_bm.experience_0_1.experience.tFileCopy_1Process(experience.java:1491)
	at freqnum_bm.experience_0_1.experience.tFileList_1Process(experience.java:1355)
	at freqnum_bm.experience_0_1.experience.runJobInTOS(experience.java:1776)
	at freqnum_bm.experience_0_1.experience.main(experience.java:1633)
[statistics] disconnected
Job experience terminé à 13:25 24/07/2017. [Code sortie=1]

PS: my Talend Open Studio is in French.

 

Best regards

BastienM

 

Six Stars

Re: Management of processing file

I find my issue, now I test for 2 results. I contact you if I have an another issue.

 

Thanks

BastienM

Nine Stars TRF
Nine Stars

Re: Management of processing file

You're welcome.
Don't forget to mark the topic as solved if it is (for people searching for the same subject).
Kudos also accepted!

TRF