How to get the first character of a string in domo beast mode analyzer
Hi I am trying to get the first letter in the product number field.
I have created a test field to remove any extra white spaces the product number field would come with and here is the calculation:
TRIM(ProductNumber
)
Next I am trying to use the Left function to get the first letter from that test field without any extra white spaces this field is called prod art:
LEFT(Test
,-9)
Here are the results I am getting
Best Answers
-
Try left(trim(productnumber),1)
1 -
CASE WHEN Prod Art = 'A' THEN 'Artwork' WHEN Prod Source = 'M' THEN 'Sourcing' ELSE 'No' END
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
You need tick marks around column names that contain spaces. Prod Art and Prod Source should have ` before and after them.
0
Answers
-
Try left(trim(productnumber),1)
1 -
Perfect this worked thank you
1 -
Had one more question regarding this topic I am not sure if there is a OR operator in domo beast mode but I am trying to make a formula where if "prod art" is "A" then display "Artwork" else if when "Prod Source" is "M" then "Sourcing" Else "No"
Here is the formula i have created which is giving me a syntax error:
CASE WHEN
Prod Art
('A') THEN 'Artwork' ELSE WHENProd Source
('M') THEN 'Sourcing' ELSE 'No' END0 -
CASE WHEN Prod Art = 'A' THEN 'Artwork' WHEN Prod Source = 'M' THEN 'Sourcing' ELSE 'No' END
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
Hi Grant,
Thank you for the quick response seems like there is a syntax error with the code do you know what it could be?
0 -
You need tick marks around column names that contain spaces. Prod Art and Prod Source should have ` before and after them.
0 -
Hey @jessdoe @GrantSmith thank you so much for the previous formula so I am running into an issue with it. So it seems like the first condition is coming correctly if Prod Art = A then I am getting artwork but when the second condition comes into effect it doesn't give me sourcing when the 3rd character in product number = M take a look at the screenshot:
Here are the formulas:
Prod Sourcing = left(trim(productnumber),3)
Exclusive= CASE WHEN
Prod Art
= 'A' THEN 'Artwork'
WHENProd Source
= 'M' THEN 'Sourcing'
ELSE 'No'
END0 -
Ok wait @Utz I'm lost. Where is Prod Source coming in? I don't even see that column in your original screenshot. Based on your original question, the case statement should read
case left(trim(productnumber),3)
when 'A' then 'Artwork'when 'M' then 'Sourcing'
else 'No' end
or, if you already have the beastmode for Prod Art created then you should be able to use:case
when
Prod Art
= 'A' then 'Artwork'when
Prod Art
= 'M' then 'Sourcing'else 'No'
end
0 -
Hi @jessdoe Sorry I think the issue is with prod sourcing I included the column in this screen shot but the formula is giving me the first 3 characters when i only need the third character of the string. Here is the screen shot:
The formula that is giving me the first 3 letters which is only supposed to give only the third character which is "M"
Prod Sourcing = left(trim(productnumber),3)
0 -
If you want just the third character, you can use substring:
SUBSTRING(`productnumber`, 3, 1)
3 = starting character number (1-based)
1 = number of characters to extract
**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
- 56 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