Page 1 of 1

Issue in capturing string by positions in transformer stage

Posted: Wed Dec 02, 2015 11:54 am
by Nagasudheerkumar
Hi,

I have a requirement while loading the file.

The below file is semicolon delimiter & Double quote for character fields.

I/p:
1000;12-11-2000;"";"ASDDIK";"R"
1001;12-12-2001;"";""TOMI"" ";"R"
1002;01-01-1982;"";"";""
1003;12-12-2001;"";"AYEHHE;JDJUE";"";"R"

Actual O/P:
1000;12-11-2000;;ASDDIK;;R
1001;12-12-2001;;""TOMI"" ;R
1002;01-01-1982;;;
1003;12-12-2001;;AYEHHE;JDJUE;;R

Present O/P:
1000;12-11-2000;;ASDDIK;;R
1001;12-12-2001;;""TOMI"" ;R;""TOMI"" ;R
1002;01-01-1982;;;;;
1003;12-12-2001;;AYEHHE;JDJUE;;RAYEHHE;JDJUE;;R

job Design:

Sequential file-->Tranformer stage(3outputs for 4th,5th and 6th delimeters)--->funnel--->Oracle Connector

Description: In sequential file, i am reading file as single column because the data has more delimiters. In transformer stage i am using staging variables for free text field(4th field) and taking the string between the delimter but it is working only for 1st row not for all the rows.

Datatype is Varchar2

stg1: Index(DSlink1.001,';',3)+2
stg2: Index(DSlink1.001,';',4)-1

in derivation field: DSlink1.001[stg1,stg2]

From second record i am not able see the desired output.
Index functions are working fine.
Can you please let me know any suggestions for this issue.

Posted: Thu Dec 03, 2015 11:30 am
by chulett
So... which of these two is your "desired" output:

Actual O/P
Present O/P

Guessing the first (Actual) is what you desire and the second (Present) is what you are getting but would like to be sure before I lose too many brain-cells puzzling out more of this. :wink:

Posted: Thu Dec 03, 2015 2:12 pm
by ray.wurlod
Your logic is wrong, which is why things are repeating.

The simple solution would be to read each line as a single VarChar and to use a Convert() function to remove the double-quote characters.