Help with LEFT function in Beast Mode CASE Statement

I am having trouble with the LEFT function in a CASE statement. It works as expected outside the CASE statement.
When I use this beast mode:
LEFT(`Material`, 4)
I get the first 4 characters in the Material column.
When I use this Beast mode
(CASE when `Process`= 'Lathe' then
'Lathe'
/*LEFT(`Material`, 4)*/
end)
I get several items in the column with 'Lathe'
But when I use this beast mode
(CASE when `Process`= 'Lathe' then
/*'Lathe'*/
LEFT(`Material`, 4)
end)
I don't get anything in that column
I was careful to pick 'material' from the dataset fields in all cases.
Any ideas?
Best Answer
-
Is there always data in all 3 columns: Process, Lathe, Material? If you aren't seeing the left 4 characters of material when the process column equals the lathe column, I would doublecheck that the material column is populated when the process and lathe columns are the same.
To troubleshoot, I would use a table card with those 3 columns in the table and then create a beast mode that says:
CASE WHEN 'Process' = 'Lathe' THEN 'Y' ELSE 'N' END
I would then drag this beast mode into the filters and filter to Y. The table should then show you the values that you would be working with in your earlier beast mode and may shed some light as to what the issue is.
Another thing to try would be to apply the TRIM and LOWER functions to your evaluation of the process and lathe columns to ensure there isn't spacing or case sensitivity causing issues. You could also apply the TRIM function to the material column before applying the LEFT function.
Hope this helps.
**Check out my Domo Tips & Tricks Videos
**Make sure toany users posts that helped you.
**Please mark as accepted the ones who solved your issue.2
Answers
-
Is there always data in all 3 columns: Process, Lathe, Material? If you aren't seeing the left 4 characters of material when the process column equals the lathe column, I would doublecheck that the material column is populated when the process and lathe columns are the same.
To troubleshoot, I would use a table card with those 3 columns in the table and then create a beast mode that says:
CASE WHEN 'Process' = 'Lathe' THEN 'Y' ELSE 'N' END
I would then drag this beast mode into the filters and filter to Y. The table should then show you the values that you would be working with in your earlier beast mode and may shed some light as to what the issue is.
Another thing to try would be to apply the TRIM and LOWER functions to your evaluation of the process and lathe columns to ensure there isn't spacing or case sensitivity causing issues. You could also apply the TRIM function to the material column before applying the LEFT function.
Hope this helps.
**Check out my Domo Tips & Tricks Videos
**Make sure toany users posts that helped you.
**Please mark as accepted the ones who solved your issue.2 -
Thanks so much, you nailed it! I was missing materials in the material column. I so appreciate the help. Once you said it, it was obvious what was happening.
0
Categories
- All Categories
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 311 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3.8K Transform
- 659 Datasets
- 116 SQL DataFlows
- 2.2K Magic ETL
- 816 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 82 App Studio
- 45 Variables
- 776 Automate
- 190 Apps
- 481 APIs & Domo Developer
- 82 Workflows
- 23 Code Engine
- 41 AI and Machine Learning
- 20 AI Chat
- 1 AI Playground
- 2 AI Projects and Models
- 18 Jupyter Workspaces
- 411 Distribute
- 120 Domo Everywhere
- 280 Scheduled Reports
- 11 Software Integrations
- 145 Manage
- 141 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 115 Community Announcements
- 4.8K Archive