How can I create a beastmode that will return the desired substring in a field?
Hi all,
I've given this multiple attempts and just can't seem to get it. I have a field called 'Destination' that I want to use in a Beastmode that will return the first substring of "B-FGI" or "FGI" in a value such as "Doe, John A-B-FGI-20.15.0003.B-FGI" or "Doe, John A-FGI-20.15.0003.B-FGI". I also want to create another Beastmode in that same value that will return the locator number and following sub inventory: "Doe, John A-B-FGI-20.15.0003.B-FGI". The substring can also end in "FGI" such as "Doe, John A-B-FGI-20.15.0003.FGI"
Note: Value lengths are inconsistent. The hyphen position and count is also inconsistent as I want to return "B-FGI" or "FGI". I will include some examples below and bold the substrings I'd like to extract. So far I've tried SPLIT_PART but since there's a '-' in between the substring so it does not seem to work. Functions such as REGEX, POSITION, INDEX do not seem to work in Domo or maybe I am using it wrong.
Column Name: Destination
1st beastmode
Doe, John A-B-FGI-20.17.0003.B-FGI
Walker, Mary C-FGI-19.12.0003.FGI
Doe, Jane-B-FGI-RLB.02.01.B-FGI
2nd beastmode
Doe, John A-B-FGI-20.17.0003.B-FGI
Walker, Mary A-FGI-19.12.0003.FGI
Doe, Jane-B-FGI-RLB.02.01.B-FGI
Best Answer
-
Because you have variable length in your string I'd recommend utilizing a formula tile in a Magic ETL to perform a regular expression.
FGI
REGEP_REPLACE(`Destination`, '^[^\-]*\-((\w\-)?FGI)-(\d{2}\.\d{2}\.\d{4}.*)$', '$1')
Tail end:
REGEX_REPLACE(`Destination`, '^[^\-]*\-((\w\-)?FGI)-(\d{2}\.\d{2}\.\d{4}.*)$', '$3')
You can play around with the regular expressions at websites like
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0
Answers
-
Because you have variable length in your string I'd recommend utilizing a formula tile in a Magic ETL to perform a regular expression.
FGI
REGEP_REPLACE(`Destination`, '^[^\-]*\-((\w\-)?FGI)-(\d{2}\.\d{2}\.\d{4}.*)$', '$1')
Tail end:
REGEX_REPLACE(`Destination`, '^[^\-]*\-((\w\-)?FGI)-(\d{2}\.\d{2}\.\d{4}.*)$', '$3')
You can play around with the regular expressions at websites like
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0
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.8K Visualize
- 2.5K Charting
- 737 Beast Mode
- 55 App Studio
- 40 Variables
- 684 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 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