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!
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
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.
you could also just include your case statement in your initial select clause in your connect in-db. SQL alias (AS) usually works...
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.
User | Count |
---|---|
63 | |
28 | |
23 | |
23 | |
22 |