Hi,
I have a quesion as below:
IPfield
Nafta,no2,2012|Cafta,no2,2012|bafta,no2,2012
should get a data like this below
OPfield
Nafta|Cafta|bafta
Please note the IPfield data can more with pipes.
for example i can also have data like:
Nafta,no2,2012|Cafta,no2,2012|bafta,no2,2012|Cafta,no2,2012|bafta,no2,2012
OPfield should be
Nafta|Cafta|bafta|Cafta|bafta
Could please help to figure out this logic.
Regards
To get data before commas and pipe
Moderators: chulett, rschirm, roy
Two Field() functions could pull each piece out, first delimited by pipe and then the result delimited by comma. If you are on 8.5 or higher, transformer looping can be used to iterate through the fields based on a count of the pipes.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Hi Cherukuri,
If you have the pattern no2,2012 is common for each delimited substring then you can use-
If you have the pattern no2,2012 is common for each delimited substring then you can use-
Code: Select all
Convert("no2,2012","",IPfield )
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
With a BASIC Transformer stage you can use multi-value-handling functions such as Fields().
Code: Select all
Convert(@FM, ",", Fields(Convert("|", @FM, InLink.TheString), ",", 1, 1))
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
That won't work for "nafta" because every "n" is converted to "".bhasds wrote:Hi Cherukuri,
If you have the pattern no2,2012 is common for each delimited substring then you can use-
Code: Select all
Convert("no2,2012","",IPfield )
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.