Beast Mode to null out values

Why is this SQL code throwing an error associated with the NULL?
CASE
WHEN `hire_year` = ‘2022’ THEN `percent_value`
WHEN `hire_year` != ‘2022’ THEN NULL
END
Best Answers
-
Is there a particular reason you need them to be null? If they are numeric values you can set them to = 0 and if they are strings you can set them to = ‘’
it looks like you are working with percentages, so could you just set it to = 0?
If I solved your problem, please select "yes" above
0 -
Is 2022 a column? Or is it a string value? You have the ` around both sides of it which is used for columns names. If 2022 is not a column, it will throw an error. If you are wanting to look for the string value 2022 then you should have single quotes around it.
**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.0
Answers
-
Just use THEN ‘’ END
If I solved your problem, please select "yes" above
0 -
That solution is still throwing an error.
0 -
Hmm maybe just eliminate line 3 and replace it with ELSE ‘’
If I solved your problem, please select "yes" above
0 -
Is there a way to just set it to NULL?
0 -
Is there a particular reason you need them to be null? If they are numeric values you can set them to = 0 and if they are strings you can set them to = ‘’
it looks like you are working with percentages, so could you just set it to = 0?
If I solved your problem, please select "yes" above
0 -
Is 2022 a column? Or is it a string value? You have the ` around both sides of it which is used for columns names. If 2022 is not a column, it will throw an error. If you are wanting to look for the string value 2022 then you should have single quotes around it.
**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.0 -
Good catch @MarkSnodgrass, I was looking at it on my phone and the ticks appeared to be ' not `
If I solved your problem, please select "yes" above
0
Categories
- All Categories
- Product Ideas
- 2.1K Ideas Exchange
- Data Connections
- 1.3K Connectors
- 309 Workbench
- 17 Cloud Integrations
- Data & ETL
- 2.3K Magic ETL
- 120 SQL DataFlows
- 666 Datasets
- Visualize & Apps
- 90 App Studio
- 198 Pro-code Components
- 2.6K Charting & Analyzer
- 873 Calculations & Variables (Beast Mode)
- AI & Data science
- 23 Domo AI & AI Chat
- 4 Managing AI
- 18 Jupyter Workspaces
- Automate
- 122 Workflows
- Alerts
- Distribute
- 118 Domo Everywhere
- 284 Reporting
- Manage
- 145 Governance & Security
- 489 APIs
- 11 Add-ins & Plugins
- 13 Domo Community Gallery
- 49 Product Releases
- 13 Domo University
- Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 118 Community Announcements
- 5K Archive