Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Using user input to modify WHERE statement in query BEFORE it runs

jtermi03
5 - Atom

Hi, I have a workflow that runs a query on multiple different ODBC connections and joins them together. Without a filter, it returns millions of results and takes a long time.

 

I added a user input where they can input a request number which is then used in a dynamic input tool to modify a where statement. It currently works, but the full query runs first in the Input Data. The results are what I want but it still takes forever. 

 

I imagine I want to do something similar but have the variable modify the initial query. Here's a screenshot of what it currently looks like, what can I do to accomplish this?

 

workflow screenshot.PNG

2 REPLIES 2
SergioD
7 - Meteor
Hi,

I suggest you to create a text input with a field to contain the user input, then, move the query from your input tool to a dynamic input tool but, add a clause to specify the request number, for example:

query example:
============

"select *
from schema.table
where request_number=123456789"

In the dynamic input tool, select 'Modify sql query' and then 'replace a specific string'

in the pop-up window, replace put 123456789 as your replacement text and in the field selection select the field that you created in the text input tool.

Hope this work for you, in the zip there are some images (poor quality, I'm replying frok my phone) of how will look.
jtermi03
5 - Atom

That worked, thanks a lot!

Labels