Link to home
Start Free TrialLog in
Avatar of jknj72
jknj72

asked on

Additional help requested for question ID: 28683216

I don't know how to link this question to the original I asked but the ID: 28683216

 I checked this morning and I need some further assistance. I guess I should have stated more examples of the data I need to cleanse. I tried it with the string below and it didn't work?
I think If I knew how to incorporate any new characters, if that's the problem, that I need to look for maybe that would be best for me?

Im gonna keep testing to try and narrow it down....

pass this to function
'COMPANYA SERVICES INC L/C/F     COMPANYB TIRE EXCHANGE INC'

get back
'COMPANYA SERVICES INC LCF     COMPANYB TIRE EXCHANGE INC'

need returned
'COMPANYB TIRE EXCHANGE INC'

THANKS FOR THE HELP!!!!
Avatar of jknj72
jknj72

ASKER

Just to put a little more emphasis on the logic to help understand better.

The data is structured in a way that if we use a company, lets say Company A, and then another company is used the data entry people will put some sort of version of 'LCF' in front of the old company and then enter the new company. So it would look like 'Company A L/C/F Company B' so I would need Company B returned from the function. And this can go on and on and on so I would always need the company after the last variation of LCF

The real issue is all the different variations of the LCF that is entered to look for.

So far we are looking for
"LCF", "-LCF", "L/C/F", "L/C/F,", "L.C/F/,", "L/C/F/", "L.C.F", "L.C.F.", "-L/C/F", "L/C/F-", "L-C-F", "LCF/", "L/C/F:", "LCF:", ".L/C/F", "L\C\F", "L\C\F:", ".L\C\F", ".L/C/F", "L C F", "LOST CONTENT FOR", "LABOR CONTRACTOR FOR:"

Sorry for not mentioning this in the first question

THANKS
Avatar of slightwv (䄆 Netminder)
I see the flaw in my original solution.  It required TWO LCF entries.  Let me see if I (or another Expert) can figure out a solution for 0 to many.
Avatar of jknj72

ASKER

Ok Thanks slight
ASKER CERTIFIED SOLUTION
Avatar of johnsone
johnsone
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jknj72

ASKER

Johnson, the value passed in can have any number of LCF variations, literally....I want to return just the one value back so although what your function is doing does return the last value, The problem is that it will be just the one value sent to the function and that one value is the one that needs to be evaluated and then the last part of the string returned.

I hope that helps

Thanks
JK
>>The problem is that it will be just the one value sent to the function and that one value is the one that needs to be evaluated and then the last part of the string returned.


I don't understand this part of the statement.

It looked like johnsone's post did what you needed so I quit working on it.  What isn't it doing?
>>>  can have any number of LCF variations, literally..

you mean it can look like this?

"A LCF  B  L.C.F C  L/C/F  D"

and if so you want "D"  ?
Avatar of jknj72

ASKER

Yes that is correct.....
Avatar of jknj72

ASKER

Slight
>>I don't understand this part of the statement.
>> It looked like johnsone's post did what you needed so I quit working on it.  What isn't it doing?

I am actually double checking what he sent right now. Don't see the need for the UNION ALL so I have to do it without and will let you guys know...
>>Don't see the need for the UNION ALL

You don't need that.

That is just a CTE (WITH) to set up the test data.  That isn't part of what you need.

You just need the SELECT after that replacing the table and column with your actual tables.
Avatar of jknj72

ASKER

It actually is working Johnson just let me do some additional testing and I will let you know...Thanks
Avatar of jknj72

ASKER

Yeah johnsone I think you nailed it. I took out the UNION ALLs and tested it and it works great. Thank you for your help
Avatar of jknj72

ASKER

Thank you very much
Avatar of jknj72

ASKER

Thanks Slight
All I did was a slight modification of what slightwv posted on the first question.

The UNION ALLs were just there to generate the test data.  They aren't part of the processing.
Avatar of jknj72

ASKER

I understand now that slight cleared it up for me...Im a little slow ;)