Alteryx Designer Desktop Discussions

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

Visual Query Builder using IN when connecting to excel file

cowannbell
9 - Comet

Our database is very large, so I'm trying to filter as much data as possible in the Visual Query Builder.  I'm try to do this.  It is not accepting the file location.  Can I do this and if so, what am I doing wrong?

 

select GDAD00D.TBL_DAD_RATES_AUSH.SERVC_CD,
GDAD00D.TBL_DAD_RATES_AUSH.RATE_SYS_CD,
GDAD00D.TBL_DAD_RATES_AUSH.RATE,
GDAD00D.TBL_DAD_RATES_AUSH.EFFTV_DT,
GDAD00D.TBL_DAD_RATES_AUSH.SPCLTY,
GDAD00D.TBL_DAD_RATES_AUSH.SERVC_TYPE,
GDAD00D.TBL_DAD_RATES_AUSH.ERR_IND,
GDAD00D.TBL_DAD_RATES_AUSH.TRMN_DT
from TBL_DAD_RATES_AUSH
where GDAD00D.TBL_DAD_RATES_AUSH.RATE_SYS_CD IN (C:\data\DADs.txt)
and GDAD00D.TBL_DAD_RATES_AUSH.ERR_IND = 'N'
and GDAD00D.TBL_DAD_RATES_AUSH.TRMN_DT =
order by GDAD00D.TBL_DAD_RATES_AUSH.RATE_SYS_CD, GDAD00D.TBL_DAD_RATES_AUSH.SERVC_CD

6 REPLIES 6
mceleavey
17 - Castor
17 - Castor

Hi @cowannbell ,

 

this method will not work simply because you are trying to define a range, but instead are providing a filepath to an external source. This is not how you reference a secondary source and so it would never understand the syntax here.

 

You can copy the values on your text file and present them in the WHERE clause as follows:

 

mceleavey_0-1622651918100.png

 

Alternatively you can connect using the In DB tools, which will allow you to stream in the data from your external source and join to the In DB table. This will then allow you to use the Join In Db tool to reduce your data before streaming the results out into Alteryx:

mceleavey_1-1622652138912.png

 

mceleavey_2-1622652156624.png

 

I hope this helps.

 

M.

 



Bulien

cowannbell
9 - Comet

Okay, so the in database is the way to go.  

 

Now when I try to use the Data Stream in tool and select Temporary Table it says that I need to select a table.  I can't write in the database, so that may be an issue here.

mceleavey
17 - Castor
17 - Castor

@cowannbell ,

 

You need to load in that external source, put it into tabular format, then use the data stream in tool to load it up into the remote DB as a temp table (it will only exist while the workflow is running) and then it joins to the table. You are essentially using the join to restrict the data. You only want those records from the source table where it joins to the external source.

 

M.



Bulien

cowannbell
9 - Comet

I can't write to this external source.  When I try to do temporary table, it says that I haven't selected a table and it won't let me create a new table.

mceleavey
17 - Castor
17 - Castor

HI @cowannbell ,

 

I didn't say write to an external source.

 

Load in the text file you were referencing in your SQL script, put it into tabular format, then stream that data in to connect to your In DB stream, as per the previous screenshot.

However, if you don't have write access to the DB, even for temp tables, then you can't do it. You'll need to carry out the first option which is to paste in the range in the IN clause.

 

M.



Bulien

cowannbell
9 - Comet

Okay, thanks.  Yes it doesn't appear that I have write access at all.

Labels