Hi, What is the best approach to transform my Field Name to Field.
Currently, I approach to resolve this by adding a Text Input Tool with the second table and then use a Find and Replace to do the trick. I wanted to know the various approaches to resolve this.
| Field Name | Field |
| summary______ | summary_ |
| issuetype_self_____ | issuetype_self_ |
| issuetype_id_____ | issuetype_id_ |
| issuetype_description_____ | issuetype_description_ |
| issuetype_iconurl_____ | issuetype_iconurl_ |
| issuetype_name_____ | issuetype_name_ |
| issuetype_subtask_____ | issuetype_subtask_ |
| issuetype_avatarid_____ | issuetype_avatarid_ |
| watches_self_____ | watches_self_ |
| watches_watchcount_____ | watches_watchcount_ |
| watches_iswatching_____ | watches_iswatching_ |
| timespent______ | timespent_ |
| created______ | created_ |
| timeoriginalestimate______ | timeoriginalestimate_ |
| Find | Replace |
| __ | _ |
| ___ | _ |
| ____ | _ |
| _____ | _ |
| ______ | _ |
| _______ | _ |
Solved! Go to Solution.
Hi @Mario36 ,
One way to do that is by using a Regex tool configure to replace a pattern you define in the regular expression box with a replacement text
Your pattern can be _+, so that means 1 or more instances of an underscore and you want to replace that with a single underscore
Cheers,
Angelos
Thank You @AngelosPachis , this worked like a charm.
Any other approaches you can think of ?
I like @AngelosPachis approach better - but if you need a hardcoded non-regex approach - you could do worse than:
trimright([Field Name],"_")+"_"
which removes the trailing "_" and then adds one back - because that's what you want it to do.
there are numerous other approaches too (hey! You can tokenize everything and then use a multi-flow to find when the strings of "_"'s start then null() them and summarize/concatenate) but I'd stick with a simple regex/non-regex solution.
@Mario36 and an extra two besides what @apathetichell suggested which works great.
The formula is a bit of a cheat as it's a Regex Replace expression
@AngelosPachisMazel Tov on the new badge! I'm still in the "maybe one day" stage...
Unfortunately I did not want to use a Find and replace and a Text Input tool
Thank you @apathetichell ! We all have been at this stage, best of luck for whenever you feel ready and decide to give it a try!
