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
-
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
- 7.7K All Categories
- 5 Connect
- 921 Connectors
- 244 Workbench
- 477 Transform
- 1.8K Magic ETL
- 60 SQL DataFlows
- 446 Datasets
- 40 Visualize
- 199 Beast Mode
- 2K Charting
- 8 Variables
- 1 Automate
- 348 APIs & Domo Developer
- 82 Apps
- Workflows
- 14 Predict
- 3 Jupyter Workspaces
- 11 R & Python Tiles
- 241 Distribute
- 59 Domo Everywhere
- 241 Scheduled Reports
- 15 Manage
- 36 Governance & Security
- 28 Product Ideas
- 1.1K Ideas Exchange
- Community Forums
- 14 Getting Started
- 1 Community Member Introductions
- 49 Community News
- 18 Event Recordings
- 579 日本支部