Advent of Code is now back for a limited time only! Complete as many challenges as you can to earn those badges you may have missed in December. Learn more about how to participate here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Radio Button use-case

rishabhgupta36
7 - Meteor

I would like to build a workflow running as below:

 

If date button is selected then input date and display all data for that date in the query like: select * from table where date='user_input_date'

 

OR

 

If user_id button is selected then input date and display all data for that user_id for all dates like: select * from table where user_id='user_input_user_id'

10 REPLIES 10
KGT
13 - Pulsar

If you need radio buttons to select which then it's either a macro (for use inside a workflow) or an app (user interface for the workflow). An app is what you would post to gallery to be used from a web front end.

 

The radio button will perform an action (via action tool) on one or more of the tools in your workflow. Take a look at this tool mastery post: https://community.alteryx.com/t5/Tool-Mastery/Tool-Mastery-Radio-Button/ta-p/127454

 

In your case, you could use the radio button to select between each query and then feed that in to a Dynamic Input tool to read from the database.

rishabhgupta36
7 - Meteor

Right, i'll be building an app and publish it into the gallery. 

 

But how do we run different queries based upon selection.

KGT
13 - Pulsar

It depends on your actual use case, but the simplest implementation I can think of is:

Text Input containing both queries and a field identifying them "UserQuery" vs "DateQuery" for instance although I prefer Query1/Query2.

Filter to select "DateQuery"

Radio Button adjusting the filter to either "DateQuery"/"UserQuery"

Dynamic Input to run the query.

 

I don't have a DB connection set up to replicate, but if you set up the above, then you should be able to translate that to your use case.

rishabhgupta36
7 - Meteor

Looks like a plan, I'll try this out.

 

Can you help in below workflow - not able to get the output of the radio button text box even after adding the browse button

 

 

KGT
13 - Pulsar

Find attached a mock up of the process. The dynamic Input is not configured as I don't have a DB connection that i can share available. I've used a dummy query to replace, that could just be a default instead and then only one of the radio buttons needs to be attached.

 

AlteryxGui_9CLW8QxNWW.png

rishabhgupta36
7 - Meteor

Thank you, but the user needs to input date or user_id where will the text input component be attached to replace the corresponding value in the query?

KGT
13 - Pulsar

That'll be text boxes on to the text input like in your screenshot. I advise picking a random piece of text in each query to replace. Otherwise, you may need 2 text input tools, one for each query and then union them together.

 

You can use the interface designer to then nest those text boxes under the relevant radio button.

rishabhgupta36
7 - Meteor

Please find the below snip, Whenever I input the date the corresponding query runs fine but on giving the user_id the corresponding query does not run.

 

 

KGT
13 - Pulsar

I don't understand what the 2nd filter is meant to be doing, the first filter is meant to select one of the 2 queries and then run that.

Labels
Top Solution Authors