Page 1 of 1

how to satisfy for unkown incoming data for multiplescenario

Posted: Mon Aug 20, 2012 3:59 pm
by marpadga18
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

Posted: Mon Aug 20, 2012 4:58 pm
by ray.wurlod
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")

Posted: Mon Aug 20, 2012 4:59 pm
by chulett
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:

Code: Select all

Field(InputColumn,"~",1,999)
After that you'd just need to remove the trailing "~".

Posted: Mon Aug 20, 2012 5:05 pm
by marpadga18
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 ...
Hi chulett,

The literal string will be LFA1 and VENDOR only not other than this. Only 2 posibilities

Posted: Mon Aug 20, 2012 5:06 pm
by ray.wurlod
Andrew?

Posted: Mon Aug 20, 2012 5:08 pm
by chulett
Andrew's not here man.

Posted: Mon Aug 20, 2012 5:14 pm
by marpadga18
Sorry its my mistake could give some derviation for the above

Posted: Mon Aug 20, 2012 5:25 pm
by chulett
We both did.

Posted: Mon Aug 20, 2012 5:28 pm
by marpadga18
chulett wrote:We both did.
I said sorry

Re: how to satisfy for unkown incoming data for multiplescen

Posted: Mon Aug 20, 2012 5:46 pm
by marpadga18
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

Re: how to satisfy for unkown incoming data for multiplescen

Posted: Mon Aug 20, 2012 6:20 pm
by marpadga18
after this I did the substring it worked fine thanks for your idea.

Posted: Mon Aug 20, 2012 10:10 pm
by chulett
marpadga18 wrote:
chulett wrote:We both did.
I said sorry
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.

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. :wink:

Posted: Mon Aug 20, 2012 11:39 pm
by Kryt0n
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