Any ideas? Looks like in WebI, the numeric portion needs to be extracted before tonumber() can convert it. I’m not sure how to get rid of the random characters at the end.
Create on object in Universe with below formula
case when soundex(“Character Field from Data base”) is not null then rtrim(“Character Field from Data base”,soundex(“Character Field from Data base”)) else “Character Field from Data base” end
You can remove all the characters from the string and then use a to_number function.
How you do this would depend on your database. In Oracle you could use the translate function to get rid of the characters and then use to_number to convert it to a number.
Thanks for the suggestions, but I’m not looknig for a universe solution to this problem, WebI only.
I understand using the ToNumber() function in WebI, but removing the non-numeric characters is the hard part for me. There could be 1,2,3…x number of characters, so I can’t hardcode a left(trim([field]),2). Guess I’ll keep experimenting.
And then check whether this formula gives you only numbers from the original string:
Replace(Trim([string]);[alphacharacters];"")
I am expecting the above formula to work if the non-numerical characters are only at the end, it means there are numerical characters at the beginning of the original string following by the non-numerical characters only.
So it won’t work for a string like 100AA3BB. But it should work for a string 1003AABB.
Can you check that? I don’t have an access to WebI now.
Yes, you’re right. I just copied and pasted it and there was no space. The first time I looked at it and typed the formula in, and at first glance it looked like there was a space.
Having read through this post, it seemed the most appropriate to reply to! I would like to extract character instead of number! This maybe a basic question and I have looked at other topics on the forums but they do not seem to answer my question and this seems the closest I am going to get!
Basically my problem is this -
I have a string of letters which are never the same but are always the first few characters
could be AB or ABC for example - followed by 1 or 12 or 123
I wish to trim the trailing numeric characters.
I could have a trim function but as amount of characters are ever shifting this would not work. It seemed logical therefore to use a function to recognise when ever a number appeared remove them! (I also noted with a lot of the functions there seemed to be a lot of use of positioning of characters which would also not work - or I may be reading to much into the formulas!)
I will keep looking and trying with this, but any thoughts would be appreciated!