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'
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.
Right, i'll be building an app and publish it into the gallery.
But how do we run different queries based upon selection.
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.
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.
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?
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.
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.