ETL Formula to extract numeric ID at the end of campaign name
Hello - does anyone know how to write an ETL formula to extract the numeric ID at the end of this campaign name: Display_Retargeting Package_07/09/24-12/31/24_BA:4114356 so that I can get a new column with just the campaign ID?
Thank you so so much for any help!
Best Answer
-
Glad you got it to work. Yes, using the SPLIT_PART function with it looking for the underscore character will return the ID you want.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.1
Answers
-
If it is always after the the colon, you can use the SPLIT_PART function:
SPLIT_PART(fieldname,':',2)
If it is always a certain number of digits, you can use the RIGHT function:
RIGHT(fieldname,7)
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.0 -
a REGEX version would be:
REGEXP_REPLACE(`field`, '^.*(\d+)$', '$1')
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
You can use the SUBSTRING_INDEX() function in a formula tile in Magic ETL:
SUBSTRING_INDEX(String
, ':', -1)If I solved your problem, please select "yes" above
0 -
Thank you so much Mark :) I tried both of your formulas and this is the result I am getting. I was hoping to get the numeric string at the end instead of the name within a campaign. Any thoughts? Thanks again I truly appreciate the help.
0 -
Can you provide a few more sample campaign names? The word Expense is not in your first sample campaign name that you provided initially so I think I need to see a few more sample rows to make sure my suggestions will work for you.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.0 -
Of course, here you go, copied and pasted from the dataset
Display_Retargeting Package_07/09/24-12/31/24_BA:4019796
Search_AEC Package_07/09/24-12/31/24_BA:4019782
0 -
Are you referencing the correct field in your formula tile? Neither of these two samples contain the word Expense so there is no way the preview could display Expense in the result of the RIGHT function usage. I would double check that you are referencing the correct field in the formulas.
Based on these two samples, both of my suggested functions should return the numeric id you are looking to extract.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.1 -
I got it to work THANK YOU SOO MUCH! I didnt realize the data set had campaigns with the Expense name in it so I ran it and was able to get a column with just the campaign Id. :)
I have one follow up question if that is ok? Would I use the formula below to extract the numeric ID at the end of this utm_content name: ResponsiveSearch_4019775
SPLIT_PART(`utm_content`,'_',2)
What I am trying to figure out is how I can join two data sets, one with the campaign name with ID and one with utm content with ID, so I can get campaign and spend data in one card at the end. I figured extracting the ID's at the end of both of those fields and then joining on the newly created ID columns would be the best way.
0 -
Glad you got it to work. Yes, using the SPLIT_PART function with it looking for the underscore character will return the ID you want.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.1 -
Thank you so very much you have been super!
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive