I'm trying to do a string manipulation in CR XI R2 and it's not working for me. It's probably simple and I'm overcomplicating it.
I have a string value (named "itemCode") composed of letters and numbers which I pass into a formula field with the attached code. I need to conditionally "truncate" or cut a certain number of the last characters off and display them (truncated and full) in my report. In most of my cases the code works, but with a value of R4.0022, I would like to end up with R4.002 but what I'm getting is R4.00. The line that is causing me problems is:
if {chaProducts.itemCode} like "*.????" then replace({chaProducts.itemC
ode},right
({chaProdu
cts.itemCo
de},1),"")
It seems to replace the number 2 wherever it finds it, but I only want it to cut off the final 2. So I would like to replace the 2 only once, starting at the end. I know I can tell a "replace" function how many times to replace a string but can I tell it to start looking at the end of the string and work backwards? Another clever function perhaps? Any help would be appreciated.
thanks
Start Free Trial