Six Stars

File check - check columns + delimiters

Hello all,

 

Everyday i process a csv file (Smiley Wink with 15 columns but sometimes the format of this file is not correct which may be an error with an extraction itself.

 

Types of errors with the csv file :

 

- Number of column greater than 15

- Number of column less than 15

- Number of column is 15 but certain row contain only > OR < column

 

How can i check each of these errors before processing? If one of these are found, i can use tDie to end the process.

 

In my case, i cannot use tSchemaComplianceCheck, since it verifies only type, length, null, date format?

 

Good file :

  

Nom;Prenom;Adresse;Telephone;Date de naissance;Ville
Jin;Kazama;Moka;56656496;7/11/1989;Pamplemousses
Naruto;Uzumaki;Triolet;56461654;2/12/1989;Pamplemousses
Paul;Phoenix;Soulliac;97146665;23/08/1987;Pamplemousses

 

 

Bad file :

 

Nom;Prenom;Adresse;Telephone
Jin;Kazama;Moka;56656496
Naruto;Uzumaki;Triolet;56461654
Paul;Phoenix;Soulliac;97146665
Nom;Prenom;Adresse;Telephone;Date de naissance;Ville
Jin;Kazama;Moka;56656496;7/11/1989
Naruto;Uzumaki;Triolet;56461654;2/12/1989;Pamplemousses
Paul;Phoenix;Soulliac;97146665;23/08/1987;Pamplemousses
Nom;Prenom;Adresse;Telephone;Date de naissance;Ville
Jin;Kazama;Moka;56656496;7/11/1989;Pamplemousses
Naruto;Uzumaki;Triolet;56461654;2/12/1989;Pamplemousses
Paul;Phoenix;Soulliac;97146665;Pamplemousses

 

Can you advice please?

 

Best regards,

asadasing

2 REPLIES
Eleven Stars TRF
Eleven Stars

Re: File check - check columns + delimiters

Hi,
As a basic solution, you can use tFileIinputFullRow, then count the number of field separators to exclude incorrect records.

TRF
Four Stars

Re: File check - check columns + delimiters

Hi,

 

In the tfileInputDelimited, in advanced settings select the option "Check each row structure against schema". Now take rejects from tfileInputDelimited. If there is any mismatch in number of columns the rows will be rejected.

 

You can count the rows in reject file, if there are any rows you can stop the process. I hope this will help.

 

Regards

Ravinder