Hello, I have a column with text (YT-V0) that precedes values. In excel, I would search and replace the value to null to remove this.
Is there a similar way to accomplish this in EasyMorph?
Hello,
you can use the "Modify column(s)" action, updating the value of "Field" with
Replace([Field], "YT-V--", "")
Alternatively, use keepafter().
I'm sorry, but I don't think I understand. I've gone to the modify columns action, and tried entering the formula as follows:
Sorry if this is a dumb question and I'm missing something that should be obvious.
Would I use this with the Modify column(s) action?
Sorry if this seems like a silly question.
No question is silly on the Community forum
Yes, use the expression in the "Modify column(s)" action.
Notice that in EasyMorph, like in Excel, function arguments are wrapped in parentheses (
and )
. They are missing in your screenshot. So, it should be
Replace([Product Ref], "YT-V--", "")
Instead of
Replace[Product Ref], "YT-V--", ""
This worked. Thank-you!
Can I ask, when enter this in the Modify Columns action, I see I have to select the column, and then I also have to specify the column again in the function. I guess this was confusing me, also because I made a typo.
So I was wondering, is there an application where I would enter a different value in "the column to replace" dropdown list, and the function.
And when I mistakenly made a typo in the column name, I got an error position 9. Is there a list of the various error codes and their meanings?
Thank-you. Is there the ability to use the keepafter() function, and specify something like the second hyphen?
Yes. For instance, you have an empty column that you want to populate with values from one or more other columns.
The error message is missing a dot (period) - we will fix that. "Error position 9" isn't an error code. It's the place of the error - the 9th character in your formula.
You can use keepafter() as follows:
keepafter([Product Ref], "YT-V--")
or, if you need to cut before the 3 hyphen:
keepafter([Product Ref], "-", 3)
See the help article for more examples: syntax:functions:keepafter [EasyMorph Help]
Thanks so much for your help. I'm loving EasyMorph, and really appreciate all your help as I'm trying to learn more of it's capabilities!
You can also use regular expressions (regex) for text processing to strip prefixes.
To remove the exact prefix YT-V--
:
^YT-V--(?<content>.*)
To remove any prefix that ends in --
:
^.*?--(?<content>.*)
To handle several possible prefixes at once:
^(?:YT-V--|YT-|VIDEO--|VID-)(?<content>.*)
Thank-you! This is really helpful.