Replace part of string with another value in Domo Cards
I have a data set showing some page names and paths of my website, a part of which has to replace with another in the domo card.
Can it be done using beast mode, using any functionality similar to 'Replace' in mysql.
Example:
Original Value: 'Site1::LandingPage > Site1::My Cart > Site2:Checkout Initiate:Checkout'
Required value: 'Landing Page > My Cart > Checkout'
Thus, 'Site1::LandingPage has to be replaced with 'Landing Page' , 'Site1::My Cart' is to be replaced with 'My Cart' and so on.
Any insights would be helpful.
Comments
-
Yes you can write a beastmode using Replace() , hopefully your values to remove are consistent.
you will need to replace within replace meaning one value at a time to replace all occurrences
for example start replacing the 1s , then a replace of 2s within the prior replace
here it is the code for your example , notice the last line is the actual beastmode to use
-- REPLACE(`String to replace`, 1, '') Replacing the number 1
-- REPLACE(REPLACE(`String to replace`, 1, ''), 2, '') Replacing the number 2
-- REPLACE(REPLACE(REPLACE(`String to replace`, 1, ''), 2, ''), 'Site', '') Replacing the 'Site' values
-- REPLACE(REPLACE(REPLACE(REPLACE(`String to replace`, 1, ''), 2, ''), 'Site', ''), ':', '') Replacing the ':' Values
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(`String to replace`, 1, ''), 2, ''), 'Site', ''), ':', ''), 'Checkout Initiate', '')Domo Arigato!
**Say 'Thanks' by clicking the thumbs up in the post that helped you.
**Please mark the post that solves your problem as 'Accepted Solution'1 -
@Godiepi provided you with the beastmode and will work if all of the replacement values are consistent and limited. If the Sites are dynamically named or many then I would recommend a mysql dataflow with the sql below. I put your string in a table named data and named the column col_1 to keep the example shorter.
-----------------
Chris0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 56 App Studio
- 40 Variables
- 684 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 123 Manage
- 120 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive