Hi alll
I have an issue while reading data from a comma delimited file. There is a simple if then else statement in a stage variable which does basic string comparison
if Field(trim(Lnk_Src_Socn.Field002),",",1) ='COS' Then 'Type1' else if Field(trim(Lnk_Src_Socn.Field002),",",1) ='MOS'
Then 'Type2' else if Field(trim(Lnk_Src_Socn.Field002),",",1) ='FOS' Then 'Type3' else StgNotificationType
This string comparison is failing frequently. I have checked the below points
1. Made sure there are no special characters in the file.
2. Loaded the string into a DB table, and wrote a select on the same string values. Got positive results
3. did a unix Grep on the file, to get positive result set again
4. trimmed the field to 3 characters, hoping that it will strip any invisible special characters
5. i went back and checked to the source and made sure nothing has changed when they generate this string.
Is there anything i can do to understand what the issue.
this simple if then else is the heart of the whole process, and with this failing i am missing most of data loads frequently
Thanks for help
Sri
String Comparision fail
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
Try this
Code: Select all
if Field(trim(Lnk_Src_Socn.Field002),",",1)[1,3] ='COS' Then 'Type1' else if Field(trim(Lnk_Src_Socn.Field002),",",1)[1,3] ='MOS'
Then 'Type2' else if Field(trim(Lnk_Src_Socn.Field002),",",1)[1,3] ='FOS' Then 'Type3' else StgNotificationType
You are the creator of your destiny - Swami Vivekananda
Sai
Sample of the input data set i get
01,COS
02,chasidh,dasdasd,asdasdasd,wdfddwasd,
03,dsfds,dsasd,asdasd,asdasdas,
04,dfoprewo,qwqe,reteererqwe
01,MOS
02,chasidh,dasdasd,asdasdasd,wdfddwasd,
03,dsfds,dsasd,asdasd,asdasdas,
04,dfoprewo,qwqe,reteererqwe
01,FOS
02,chasidh,dasdasd,asdasdasd,wdfddwasd,
03,dsfds,dsasd,asdasd,asdasdas,
04,dfoprewo,qwqe,reteererqwe
Depending on the 01 Record the data is split into different tables.
Field002 is of length 1000, Anything after the first "comma" on any row is read into Field002
Thanks
Sample of the input data set i get
01,COS
02,chasidh,dasdasd,asdasdasd,wdfddwasd,
03,dsfds,dsasd,asdasd,asdasdas,
04,dfoprewo,qwqe,reteererqwe
01,MOS
02,chasidh,dasdasd,asdasdasd,wdfddwasd,
03,dsfds,dsasd,asdasd,asdasdas,
04,dfoprewo,qwqe,reteererqwe
01,FOS
02,chasidh,dasdasd,asdasdasd,wdfddwasd,
03,dsfds,dsasd,asdasd,asdasdas,
04,dfoprewo,qwqe,reteererqwe
Depending on the 01 Record the data is split into different tables.
Field002 is of length 1000, Anything after the first "comma" on any row is read into Field002
Thanks
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
What is the output you are getting now ?
Assuming that StgNotificationType is the name of the stage variable, you need to include a condition Field001 = '01'. Otherwise each record will be used in derivation.
PS : Please provide meaningful names rather than field001 and field002 - which appears as defaults.
Assuming that StgNotificationType is the name of the stage variable, you need to include a condition Field001 = '01'. Otherwise each record will be used in derivation.
PS : Please provide meaningful names rather than field001 and field002 - which appears as defaults.