Reg. Expression to replace a list of names with a single character.
I have a column that is in a string format, and of course contains names. Majority of the rows are an empty string. What I am looking for is to take the rows that do contain a name and replace them with a 1.
i have been trying to use replace text tile then trying to use a regular expression in the 2nd step, then replace found term with a 1. I am not sure of a reg. ex. that would identify all the different names.
Best Answer
-
Hi @user048760
Are Just names included in your column and you want to blank it out or is there other information in that column that you need to retain except for the name? If it contains just the name and you want to set it to one if it is populated you could utilize a formula tile in Magic 2.0 with this code:
CASE WHEN COALESCE(`Reserved By`,'') <> '' THEN 1 END
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1
Answers
-
Hi @user048760
Are Just names included in your column and you want to blank it out or is there other information in that column that you need to retain except for the name? If it contains just the name and you want to set it to one if it is populated you could utilize a formula tile in Magic 2.0 with this code:
CASE WHEN COALESCE(`Reserved By`,'') <> '' THEN 1 END
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**1 -
I like to use the LENGTH and TRIM functions to test for this, which you can do in using the Add Formula tile in Magic ETL 2.0 or in a beast mode. It would look like this
CASE WHEN LENGTH(TRIM(`Reserved By`)) >= 1 THEN 1 ELSE `Reserved By` END
Hope this helps.
**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 -
It sounds like "if there is text then 1.
Cleanest logic will be
case when
text
is not null then 1 else 0 end.Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"0 -
@GrantSmith @MarkSnodgrass @jaeW_at_Onyx You guys are awesome. I appreciate all the insight!
1
Categories
- All Categories
- 1.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 295 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 97 SQL DataFlows
- 608 Datasets
- 2.1K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 712 Beast Mode
- 50 App Studio
- 39 Variables
- 668 Automate
- 170 Apps
- 446 APIs & Domo Developer
- 45 Workflows
- 7 DomoAI
- 34 Predict
- 14 Jupyter Workspaces
- 20 R & Python Tiles
- 391 Distribute
- 111 Domo Everywhere
- 274 Scheduled Reports
- 6 Software Integrations
- 116 Manage
- 113 Governance & Security
- Domo Community Gallery
- 31 Product Releases
- 9 Domo University
- 5.3K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 104 Community Announcements
- 4.8K Archive