how to satisfy for unkown incoming data for multiplescenario
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 96
- Joined: Fri Aug 20, 2010 8:51 am
how to satisfy for unkown incoming data for multiplescenario
Hi all
I have input.column. I need to satisfy this on both conditions any idea?
"Parse all value after the string literal i.e. LFA1 or VENDOR,
e.g.
source_data Target data
~LFA1~0005002430~ outputwould be 0005002430
~VENDOR~33940~ outputwould be 33940
~VENDOR~217~1095-1~ outputwould be 217~1095-1
I have input.column. I need to satisfy this on both conditions any idea?
"Parse all value after the string literal i.e. LFA1 or VENDOR,
e.g.
source_data Target data
~LFA1~0005002430~ outputwould be 0005002430
~VENDOR~33940~ outputwould be 33940
~VENDOR~217~1095-1~ outputwould be 217~1095-1
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Assuming these are the only two possibilities, use substring operators to extract all except the prefix, then trim leading and trailing tilde characters from the result.
Code: Select all
Trim(If Left(InLink.TheString,5) = "~LFA" Then InLink.TheString[6,Len(InLink.TheString)-5] Else InLink.TheString[8,Len(InLink.TheString)-7],"~","B")
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.
So... how accurate is your example data? Are you literally looking for just "LFA1" or "VENDOR" or does it not really matter what value the "literal string" contains? Can this requirement boil down to just taking everything after the second "~" in the string?
If so a simple Field() function will do the trick:
After that you'd just need to remove the trailing "~".
If so a simple Field() function will do the trick:
Code: Select all
Field(InputColumn,"~",1,999)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Premium Member
- Posts: 96
- Joined: Fri Aug 20, 2010 8:51 am
Hi chulett,chulett wrote:So... how accurate is your example data? Are you literally looking for just "LFA1" or "VENDOR" or does it not really matter what value the "literal string" contains? Can this requirement boil ...
The literal string will be LFA1 and VENDOR only not other than this. Only 2 posibilities
Last edited by marpadga18 on Mon Aug 20, 2012 5:07 pm, edited 4 times in total.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Premium Member
- Posts: 96
- Joined: Fri Aug 20, 2010 8:51 am
-
- Premium Member
- Posts: 96
- Joined: Fri Aug 20, 2010 8:51 am
-
- Premium Member
- Posts: 96
- Joined: Fri Aug 20, 2010 8:51 am
Re: how to satisfy for unkown incoming data for multiplescen
it worked partially for vendor it worked fine but LFA1 it brought the output with 1 and then the data? how to resolve this
source_data Target data
~LFA1~0005002430~ outputwould be 10005002430
~VENDOR~33940~ outputwould be 33940
~VENDOR~217~1095-1~ outputwould be 217~1095-1
source_data Target data
~LFA1~0005002430~ outputwould be 10005002430
~VENDOR~33940~ outputwould be 33940
~VENDOR~217~1095-1~ outputwould be 217~1095-1
-
- Premium Member
- Posts: 96
- Joined: Fri Aug 20, 2010 8:51 am
Re: how to satisfy for unkown incoming data for multiplescen
after this I did the substring it worked fine thanks for your idea.
I'm not quite sure what you think went on here, but there was no anger or issue with the wrong name being used. Heck, my reply was an obtuse reference to an old Cheech & Chong bit which is only funny if you're old like me.marpadga18 wrote:I said sorrychulett wrote:We both did.
All I was saying in response to your "give some derviation" post was to reiterate that both Ray and I had already done just that: posted two different approaches to solving your issue. Neither of which for the record involved using Convert(), that was an... interesting... solution.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Would have to be one of the most obscure discussions going...
And now that I put "Andrew's not here man" in Cheech's voice that makes a lot more sense too, I did wonder what you were on (literally) when I first read that.
As for the solution... I'm with you... it lost me but if he's happy with the result I won't look much further in to it
And now that I put "Andrew's not here man" in Cheech's voice that makes a lot more sense too, I did wonder what you were on (literally) when I first read that.
As for the solution... I'm with you... it lost me but if he's happy with the result I won't look much further in to it