Page 2 of 2

Posted: Mon Jan 02, 2012 3:18 am
by kirankumarreddydesireddy
pandeesh wrote:Can your please elaborate?
As you told, the new line character is there in the last field. then what about the record delimiter?
Can you please post your actual input data and mention what's your required output?
Please find the below sample input,

Name|EmpID|Description
Ravi|001|This is Ravi
Raj
esh|002|This is
Rajesh
Raghu|003|This is Raghu

Here you can find there exists a new line character in the first and last field for the second record.However to handle newline in the "name" field,if I enable "Contains Terminators" to yes and apply Convert(CHAR(13):CHAR(10),"",YourField) in the transformer,it has handled newline character for the first field and the ouput will be

Rajesh|002|This is
Rajesh

How to handle the newline character for the field "Description" which is the last one in our record.



Thanks
Kiran

Posted: Mon Jan 02, 2012 9:32 am
by chulett
The same way. However, it's unclear from your post if you tried repeating the Convert for the Description field as well... did you?

Posted: Mon Jan 02, 2012 10:23 am
by pandeesh
Craig,
It seems it's not possible to set YES to contains terminator for the last field(Description here).

Posted: Mon Jan 02, 2012 10:51 am
by pandeesh
kirankumarreddydesireddy wrote: Please find the below sample input,

Name|EmpID|Description
Ravi|001|This is Ravi
Raj
esh|002|This is
Rajesh
Raghu|003|This is Raghu

Thanks
Kiran
Why the output should not be:

Code: Select all

Ravi|001|This is Ravi
Rajesh|002|This is
RajeshRaghu|003|This is Raghu
i guess there's a flaw in the logic.

Posted: Mon Jan 02, 2012 11:17 am
by chulett
Or a flaw in your understanding. :wink:

Terminators in the final column must be Quoted to be recognized as data, meaning inside the quoted string that is the final column's data.

Posted: Mon Jan 02, 2012 11:47 am
by pandeesh
After marking Description field as quoted one, i am getting the below output:

Code: Select all

Ravi|001|This is Ravi
Rajesh|002|This is
RajeshRaghu|003|This is Raghu 
i have applied Convert() for all the 3 fields in transformer.

Posted: Mon Jan 02, 2012 12:08 pm
by chulett
Well... first off this isn't your topic and thus not your data, only the data that you've created in what you assume is a match for the original poster's data. Secondly, have you validated what you have as the 'terminator' inside that last field? Perhaps you should only be converting one of the two characters in question rather than the pair. There's no way for us to know what you've got there and this is further complicated by the OP being on Windows with you on a UNIX server.

While I appreciate your enthusiasm, why not wait for the post's owner to come back and say what does or doesn't work for them rather than overrunning their topic with all of your experimentation?

Posted: Mon Jan 02, 2012 12:10 pm
by pandeesh
Sure Craig!

Posted: Tue Jan 03, 2012 5:18 am
by kirankumarreddydesireddy
chulett wrote:Terminators in the final column must be Quoted to be recognized as data, meaning inside the quoted string that is the final column's data. ...
Hi Chulett,

I didnot get exactly what you meant by "Terminators in the final column must be Quoted".

Firstly my input data to the sequential file :

Name|EmpID|Description
Ravi|001|This is Ravi
Raj
esh|002|This is
Rajesh
Raghu|003|This is Raghu

My output should be :

Name|EmpID|Description
Ravi|001|This is Ravi
Rajesh|002|This is Rajesh
Raghu|003|This is Raghu


What we did to achieve this :

To handle newline in the "name" field,if we enable "Contains Terminators" to yes and apply Convert(CHAR(13):CHAR(10),"",Name) in the transformer,it has handled newline character for the first field and the ouput will be :

Name|EmpID|Description
Ravi|001|This is Ravi
Rajesh|002|This is
Rajesh
Raghu|003|This is Raghu

My concern here is how to handle the new line character in the "Description" field?

What we did was:

if we enable "Contains Terminators" to yes,It was prompting that

Column "Description" cannot cantain a non-qouted terminator because it is the last column of a delimited sequential file"

if we enable "Contains Terminators" to Quoted and apply Convert(CHAR(13):CHAR(10),"",Description) in the transformer,


the output will be :

Name|EmpID|Description
Ravi|001|This is Ravi
Rajesh|002|This is
Rajesh Raghu|003|This is Raghu


We are not sure what you meant by exactly "Terminators in the final column must be Quoted".Is that something the actual data in Description column should be quoted?

i.e

Name|EmpID|Description
Ravi|001|This is Ravi
Raj
esh|002|"This is
Rajesh"
Raghu|003|This is Raghu


It didnot work as well.



Thanks
Kiran

Posted: Tue Jan 03, 2012 7:15 am
by chulett
kirankumarreddydesireddy wrote:We are not sure what you meant by exactly "Terminators in the final column must be Quoted".Is that something the actual data in Description column should be quoted?
Yes, that is what I meant and that is what allows the stage to differentiate between termintors "in the data" and the real one at the end of the record. If that's not working for you, I'd suggest a couple of things. One would be (as mentioned above) to verify the actual character that is in the description column. It may not be a CR/LF pair. Use a hex editor or an octal dump to verify and adjust your Convert accordingly. Failing that, I'd suggest contacting your official support provider.