Six Stars

Defining specific characters limit of columns

Hello,

 

I have a csv file and for each column i want to define a specific limit of characters for each of them.

 

fgh.PNG

 

Example:

Capture.PNG

 

In my expected output :

Adresse : Limit characters to 10 only

Telephone : Limit characters to 7 only

Ville : Limit characters to 15 only

 

Capturesd.PNG

 

Apart making use of SubString expression, can the above result be achieved?

 

Is there a way to define my characters limit?

 

I have also tried to define them in the schema length but in vain?

 

bn.PNG

 

 

Best regards,

asadasing

1 ACCEPTED SOLUTION

Accepted Solutions
Six Stars

Re: Defining specific characters limit of columns

Hi,

 

You can use tSchemaComplianceCheck, as done below

 

D1.JPGD2.JPGD3.JPG

6 REPLIES
Six Stars

Re: Defining specific characters limit of columns

Hi,

 

You can use tSchemaComplianceCheck, as done below

 

D1.JPGD2.JPGD3.JPG

Five Stars

Re: Defining specific characters limit of columns

Hi Asadasing,
Sachinddhake's response is perfect! I have already implemented such logic to achieve what you were looking for! So you can adopt that solution with no doubt, accept his answer and let the Talend community make use of this amazing idea! Thanks Sachin. You rock!!
Six Stars

Re: Defining specific characters limit of columns

Hello Sachin and Vineet,

Thank you for your response.

My problem is that i don't want to rejet the data that exceed the max length but i want to process the data with the specific max length i have define.

Example:
Telephone length in input file = 10 or greater
Max Length defined : 7

In the output, it has to process the telephone qith only 7 characters.

Is this possible with tSchemaComplianceCheck?

Best regards,
asadasing
Six Stars

Re: Defining specific characters limit of columns

Solution found.

In tSchemaComplianceCheck, i can trim the excess content of column according to the length defined.

Six Stars

Re: Defining specific characters limit of columns

Thanks @asadasing, for accepting the solution and sharing tSchemaComplianceCheck Trim configuration.

Also Thanks to @Vineet for Kind words..

 

Lets share and Learn new things !!

 

Thanks,

Sachin

 

 

 

Five Stars

Re: Defining specific characters limit of columns

Well said @Sachin, Sharing helps learning faster Smiley Happy thanks