Magic ETL Help - Overwrite value in a column if another column equals one of two values
In our sales system there was a recent change to a part number, and I need to correct history in the dataset. If the 2nd Item Number is either "LOT SQD STOCK" or "LOT SQD SPECIAL" then I want to overwrite the value in the Supplier ID column to be "SQD" otherwise I want the Supplier ID column keep it's current value.
I'd like to do this in Magic ETL if I can.
Here's the basic logic:
IF 2nd Item Number equals with "LOT SQD STOCK" OR "LOT SQD SPECIAL"
THEN Supplier ID equals "SQD"
ELSE Supplier ID
Hopefully this is of use for you.
- Filter into two tables based on the criteria you mentioned below.
- Add Constant 'SQD' or whatever constant you're going to replace your Supplier ID with. (You have to do it for both tables so you can append at the end.)
- Set column value from your Constant column to overwrite your Supplier ID column for 'LOT SQD STOCK|SPECIAL' table.
Let me know if you have any questions.
P.S.: You can add in the Select Column function and choose only the columns you need since this method will give you two extra columns from the constanct columns - SQD and Not SQD.
I'm not sure if you can do that via a Magic ETL, but I know you can with a SQL transform. It would just be a case statement like the following:
SELECT *, CASE WHEN `2nd Item Number` LIKE '%LOT SQD STOCK%' OR `2nd Item Number` LIKE '%LOT SQD SPECIAL%' THEN 'SQD' ELSE `Supplier ID` END AS 'New Supplier ID'
Hope that helps. Let me know if you have any questions.
**Please mark "Accept as Solution" if this post solves your problem
**Say "Thanks" by clicking the "heart" in the post that helped you.1
Nice job. You beat me to it ?
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman
- 7.7K All Categories
- 3 Connect
- 919 Connectors
- 244 Workbench
- 477 Transform
- 1.8K Magic ETL
- 60 SQL DataFlows
- 446 Datasets
- 37 Visualize
- 198 Beast Mode
- 2K Charting
- 8 Variables
- 18 Cards, Dashboards, Stories
- 1 Automate
- 348 APIs & Domo Developer
- 82 Apps
- 14 Predict
- 3 Jupyter Workspaces
- 11 R & Python Tiles
- 241 Distribute
- 59 Domo Everywhere
- 241 Scheduled Reports
- 15 Manage
- 36 Governance & Security
- 27 Product Ideas
- 1.1K Ideas Exchange
- Community Forums
- 14 Getting Started
- 1 Community Member Introductions
- 49 Community News
- 18 Event Recordings
- 579 日本支部