We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

In- DB Toolset

Rwebber1991
8 - Asteroid

Can you create a new field using a CASE statement in the In-DB formula tool if then field you are leveraging is not present in your Connect in DB connection? Here is my issue, I am building a new field  'OVERRIDEFLAG' using the logic below but the field 'rrs.OVERRIDEFLAG' is not being selected in the Connect In-DB tool however it is present in the sql database. Is it required to select 'rrs.OVERRIDEFLAG'? I do not need this field but I will add it if it's the only way. Thanks in advance for any help!

Rwebber1991_0-1651590825110.png

 

4 REPLIES 4
OllieClarke
15 - Aurora
15 - Aurora

Hi @Rwebber1991 in order to refer to a field in your formula tool, you'll need that field in your data stream. So if you need 'rrs.OVERRIDEFLAG' to make your new field, then include it in your connect in-db, and you can immediately drop it after the formula with a select tool.

 

Ollie

Rwebber1991
8 - Asteroid

Thanks @OllieClarke this is exactly what I was looking for. One more question if you don't mind. Can you use alias' when creating fields the same way you can in sql code? I assume not, I have not been able to but just wanted to make sure I wasn't doing something wrong.

apathetichell
20 - Arcturus

you could also just include your case statement in your initial select clause in your connect in-db. SQL alias (AS) usually works...

OllieClarke
15 - Aurora
15 - Aurora

Hey @Rwebber1991 I don't believe you can alias when creating a new column in the formula tool, as you set the new column's name as part of the tool. You can subsequently change it with a select tool again if you want. 
As @apathetichell has said, if you want to just write sql, you can do it in the initial connection to the database - either in the connect in-db tool, or with a normal data input tool.

Labels
Top Solution Authors