Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing end numeric value. 1

Status
Not open for further replies.

Bluejay07

Programmer
Mar 9, 2007
780
CA
Hello,

I am trying to create a formula that checks it a value has a numeric value at the end. If it does I would like to remove it.

For example if I have ABC1, I would like to remove the '1'.

I don't think I have the formula correct:
Code:
if val(right({UPETRN.BKACCTCODE},1)) >= 0 then
    left({UPETRN.BKACCTCODE}, len({UPETRN.BKACCTCODE}) -1)
else
    {UPETRN.BKACCTCODE}

Could someone help me fix this or provide a better solution.
Thanks.

If at first you don't succeed, then sky diving wasn't meant for you!
 

What is wrong with your formula? It appears to work.

You also have the isnumeric function, which does the same thing:

if isnumeric(right({UPETRN.BKACCTCODE},1)) then
left({UPETRN.BKACCTCODE},len({UPETRN.BKACCTCODE})-1)
else {UPETRN.BKACCTCODE}

 
Thanks for the response.

The problem is the if statement. Suppose the value is ABC, then I get AB returned. If the value is ABC1, then ABC is returned.

It's removing the last character regardless if its numeric or not.

The isnumeric function is what I was looking for. That seems to work.

Thank you.

If at first you don't succeed, then sky diving wasn't meant for you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top