Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Macro help - connecting to SQL database

al_sweets
8 - Asteroid

I am looking to create a macro where the user can specify a 2 letter code which determines what table in a SQL database to download data from. I have a database that contains multiple tables with the following naming structure 'Info_XX' where XX is a two digit code. 

 

I have set up a simple workflow where I can extract data from a chosen SQL table and it will perform calculations and output it. However, I want to turn this into a macro where the user only has to specify the two digit code, and it will run the macro downloading from that specific table in SQL. Is this possible?

 

e.g. A simple text input of say "UK", and then the macro runs and downloads data from the SQL table Info_UK, and outputs the relevant info.

2 REPLIES 2
jrgo
14 - Magnetar

Hi @al_sweets,

 

Sounds like the Dynamic Input tool is what you need. I'm not sure how you intend to bring in the two digit code from the user, but the bottom Text Input tool would either be your macro input to containing a list of your two digit codes or you can use a Text Box interface tool to update the value contained within it with whatever the user specifies. Append the two sources together and create your valid table list that you can then pass into a Dynamic Input tool and configure it to replace the table configured in the template source with the field you feed it, "target_table" if referring to my example.

image.png 

 

I didn't attach any workflow because it would not be relevant or working, but this should help you conceptualize an approach.

 

Hope this helps!

 

Jimmy

al_sweets
8 - Asteroid

Hi @jrgo,

 

This is perfect! Thankyou so much. Never really got my head around the Dynamic Input Tool until now.

Labels