Parse data
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 353
- Joined: Wed Apr 06, 2005 8:45 am
Parse data
Hi,
I am reading from a table and one of the columns has the following sample data, I need to parse the data and extract 3 fields , the delimiter is '-'
Source: 205-51-510203 Required Output: 205 51 510203
Source: 201-1-10001 Required Output: 201 1 10001
Source: 202-14 Required Output: 202 14
Source:207 Required Output: 207
Any ideas, I am trying to use the Field function.
Thanks,
I am reading from a table and one of the columns has the following sample data, I need to parse the data and extract 3 fields , the delimiter is '-'
Source: 205-51-510203 Required Output: 205 51 510203
Source: 201-1-10001 Required Output: 201 1 10001
Source: 202-14 Required Output: 202 14
Source:207 Required Output: 207
Any ideas, I am trying to use the Field function.
Thanks,
Use convert.
Code: Select all
CONVERT("-", " ", in.Col)
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Premium Member
- Posts: 353
- Joined: Wed Apr 06, 2005 8:45 am
-
- Premium Member
- Posts: 353
- Joined: Wed Apr 06, 2005 8:45 am
It might, but no need to land it to a flat file. It can be taken care of in the transformer itself.
vinaymanchinila , the sample data and output that you provided gave me the impression that the hypen (-) needs to be replaced with a space and hence my resolution. Had you made it clear in your original post that the output needs to go into 3 different columns, the solution would have been different. Anywho, glad you got it working. Care to share the solution for future searchers ???
vinaymanchinila , the sample data and output that you provided gave me the impression that the hypen (-) needs to be replaced with a space and hence my resolution. Had you made it clear in your original post that the output needs to go into 3 different columns, the solution would have been different. Anywho, glad you got it working. Care to share the solution for future searchers ???
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Premium Member
- Posts: 353
- Joined: Wed Apr 06, 2005 8:45 am
Hi,
I have used the Field function, my source column has 3 values delimited by '-' and I needed 3 output columns , the following are the derivations for the 3 output columns,
SourceCol=201-232-9090
Output Col1=201 ---->Field(SourceCol,'-',1)
Output Col2=232---->Field(SourceCol,'-',2)
Output Col3=9090---->Field(SourceCol,'-',3)
Thanks,
I have used the Field function, my source column has 3 values delimited by '-' and I needed 3 output columns , the following are the derivations for the 3 output columns,
SourceCol=201-232-9090
Output Col1=201 ---->Field(SourceCol,'-',1)
Output Col2=232---->Field(SourceCol,'-',2)
Output Col3=9090---->Field(SourceCol,'-',3)
Thanks,