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.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.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 57 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 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