Hello everyone,
I have the columns "tag" and "ID" and want to combine them together in a new output column, but only if the tag starts with a number. The first part of the tag should be added to the ID with an aidditional "_". However, the first part can vary in length till it reaches the first "-". I tried using the formula tool and using the STARTSWITH() function or the regex but I do not seem to get any useful result. If adding a flexible string is not possible, I would be fine with adding it manually, sort of like this
If "tag" startswith 82 then add "_82"
If the tag does not start with a number like "82" then the ID remains untouched.
Is there someone who can help me out here? I'd really appreciate it 🙂
Tag | ID | OUTPUT COLUMN |
82-S8.2 | 45 | 45_82 |
82-F8.2 | 45 | 45_82 |
8210-S8.2.10 | 45 | 45_8210 |
8210-F8.2.10 | 45 | 45_8210 |
83-S8.3 | 45 | 45_83 |
83-F8.3 | 45 | 45_83 |
90-S9.0 | 45 | 45_90 |
90-F9.0 | 45 | 45_90 |
91-S9.1 | 45 | 45_91 |
91-F9.1 | 45 | 45_91 |
82-S8.2 | 50 | 50_82 |
82-F8.2 | 50 | 50_82 |
8210-S8.2.10 | 50 | 50_8210 |
8210-F8.2.10 | 50 | 50_8210 |
83-S8.3 | 50 | 50_83 |
83-F8.3 | 50 | 50_83 |
90-S9.0 | 50 | 50_90 |
90-F9.0 | 50 | 50_90 |
91-S9.1 | 50 | 50_91 |
91-F9.1 | 50 | 50_91 |
RHS | 60 | 60 |
Random | 60 | 60 |
Solved! Go to Solution.
Hey @LordNeilLord,
YES! I am really close to what I was looking for.
Is there a possibility to apply this rule only to "Tag" values that start with a digit (0-9)? Otherwise I receive IDs that just have the "_" addition without anything following up,
I cannot thank you enough!
Hey @Czaggy
Try this:
if REGEX_Match(Left(Tag, 1), "[0-9]")
Then toString(ID)+"_"+Left([Tag], FindString([Tag],"-"))
Else Null()
Endif
Thank you very much! I solved it filtering for values that start with a number first, but your solution is even cleaner.
Thank you @LordNeilLord