community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Need to pass parameters to SQL query

Meteor

Hi gurus, I need to use as a data source in Alteryx the result of a query that must have a time parameter, as in 'where date_tr>"2017-03-10"', I would need to set as an external parameter the "2017-03-10". The table is way too big to load all the data and filter in Alteryx. 

 

How can I do that? 

 

Thanks in advice

Highlighted
ACE Emeritus
ACE Emeritus

There are quite a few ways to do this!  However I first need a little more info.

 

#1) Is this going to be an application that your end users (or you) run and select the date manually?

 

#2) Is the date a field that comes from another workflow result?

 

Do you want an analytic app?

If the answer to #1 is yes, then you can see up an analytic app and provide a list box / drop down option for your users. You would use this to connect to an "update" tool that would update the sql of your input tool box. I have attached an Example of this (you'd have to use your own server + database connection).

 

If you don't want an analytic app:

If you don't want an analytic app, you will likely want to either use the A) Dynamic Input tool, or #2) A macro.

 

Another example that I attached named "Dynamic input tool" is a way you can do this with the dynamic input tool (This is how I usually do this if an end user does not 'choose' the date they need)

 

 

 

 

 

Meteor

That worked perfect, thank you very much....!!

The "Developer" tools look very interesting....!

 

Cheers

Meteor

Another question: I'm obtaining the records I need quite well, but I'm having another task: I need to delete records that are before or after certain given date. So, I have the same problem but not as an input, but an output. I need to execute a "delete * from table where date > xxxx" where xxxx is a parameter, an do this BEFORE inserting all the data. 

 

How can I do that? 

ACE Emeritus
ACE Emeritus

To confirm, you actually want to alter the data in your source SQL table and completely remove specific rows.  

 

So instead of simply not pulling them in your query you want to completely remove the rows from the source table?

 

 

Labels