Add formula syntax error
Hi all,
I am brand new and trying to swim in the deep end and don't have knowledge of SQL so struggling with how to write a case/formula for one of my ETL transformations.
I want to create a column with a constant based on values in a column, essentially:
If the value of column A equals ONEY or CMDU than 45, if not than 30
For some reason an error keeps coming back that the value ONEY is not found and that the syntax is wrong. So maybe I have an additional problem beyond the syntax?
Best Answer
-
@AdamC Welcome to Domo and SQL! So your statement will look like this:
case when `Column A` IN('ONEY','CMDU') then 45 else 30 end
or
case when `Column A` = 'ONEY' or `Column A` = 'CMDU' then 45 else 30 end
Your CASE WHEN is basically your IF. I'm guessing one problem you were running into is that if the data in your column is a string (basically text, though that's not always true) then you need to put single quotes around the value.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**
3
Answers
-
@AdamC Welcome to Domo and SQL! So your statement will look like this:
case when `Column A` IN('ONEY','CMDU') then 45 else 30 end
or
case when `Column A` = 'ONEY' or `Column A` = 'CMDU' then 45 else 30 end
Your CASE WHEN is basically your IF. I'm guessing one problem you were running into is that if the data in your column is a string (basically text, though that's not always true) then you need to put single quotes around the value.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**
3 -
@AdamC Domo predominately uses MySQL syntax.
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"1 -
Thanks Rob. That worked the first go round. I think I will play with a bit and try to add some other things just to get more familiar, but that really helped me over the hump.
Jae - thanks for that. I didn't realize that about mySQL so if I do some learning I will head that direction.
Thanks again!
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 755 Beast Mode
- 61 App Studio
- 41 Variables
- 693 Automate
- 178 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive