Alteryx Designer Desktop Discussions

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

In Database Filtering

ba13891
6 - Meteoroid

I have an in database connection to an EDL table and I want to exclude certain data criteria based on multiple columns.

 

I have included a very simplified table example below.  I would like to filter dataset to only keep "Value" data where Column 1 = TL and Column 2 = LOGI,  AND  where Column 1 = O and Column 2 = DZNA.  Essentially, eliminating/keeping rows based on specified column 1 and column 2 relationships.  Any tips on how to do this?

 

 

Column 1    Column 2   Value

TL                 DZNA        100

TL                 LOGI         1400

TL                 LOGN        2000

O                  DZNA         105

O                  EGTD         100

 

8 REPLIES 8
binuacs
20 - Arcturus

@ba13891 

 

([Column 1] = "TL" And [Column 2] = "LOGI")
OR
([Column 1] = "O" And [Column 2] = "DZNA")
alexnajm
17 - Castor
17 - Castor

Can you build your filter with the Filter In-DB tool? The language may change depending on the database, but generally:

(Column 1 = "TL" and Column 2 = "LOGI") OR (Column 1 = "O "and Column 2 = "DZNA")

ba13891
6 - Meteoroid

Thanks for responding.  Filter In-DB tool accepted your the language you proposed. 

 

Do you know how I can take this a step further, and include multiple Column 2 variables?  For example, (Column 1 = "TL" and Column 2 = "LOGI", "LOGN", "LOGP").  I tried adding variables like shown; however, the Filter In-DB errored out.

 

Thanks!

alexnajm
17 - Castor
17 - Castor

It all depends on the language of the database, but you might try the IN function. 
Column 2 IN (“x”,”y”,”z”)

ba13891
6 - Meteoroid

I input the following and received a PARSE_SYNTAX_ERROR.  syntax error at or near the end of input.  Anything look off with below?

 

(`COLUMN 1` = "TL" and `COLUMN 2` IN ("LOGI","FLET","LOGN") OR (`COLUMN 1` = "O" and `COLUMN 2` = "DZNA")

alexnajm
17 - Castor
17 - Castor

You have an extra parenthesis at the beginning. 

`COLUMN 1` = "TL" and `COLUMN 2` IN ("LOGI","FLET","LOGN") OR (`COLUMN 1` = "O" and `COLUMN 2` = "DZNA")

ba13891
6 - Meteoroid

THANK YOU!

alexnajm
17 - Castor
17 - Castor

Happy to help!

Labels