hey guys, I am using the formula (text) field in a...
# suitescript
l
hey guys, I am using the formula (text) field in a saved search and trying to remove the parent name from the item name by using LTRIM(LEADING ':' FROM '{name}') - but i get "error"...anyone knows how to best use this?
t
I'm guessing you are doing this in a script? It might be best to handle this logic there so the query doesn't have to process this string manipulation. My guess is there is a null or empty string value possibly throwing your formula off but i'm pretty bad with formulas
b
REPLACE({name}, {parent} || ' : ', '')
l
not script actually, just formula (text) in saved search about to try that out @battk
b
you can make it more complex if you want to handle evil cases like items containing ' : ' in the name
l
well sum items may have subparents so maybe I do want to be more evil @battk 🙂
s
Copy code
NVL(REGEXP_REPLACE(REGEXP_SUBSTR({name},': [^:]+*$'),': ',''),{name})
Use that one, store it somewhere so you do not have to figure it out ever again
l
@Sandii - I totally gotta learn that!!!
b
i dont think that passes the evil test
i dont think you need regular expressions for this
l
from the guy who is getting into coding and learning it - NVL and NVL2 -- what's the difference?
b
generally the difference is if you want a different value if null vs you want to do something different when null
l
OH cool, THANKS!