Alteryx Designer Discussions

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

Dynamically changing the start time and time of SQL query

Divyaranga
5 - Atom

My question is

 

When I give a SQL statement.

 

Select * from MoneyTransactions where recordtime>='2021-05-01 00:00:00' and recordtime<='2021-05-07 23:59:59'.

 

I want to dynamically change the recordtime   recordtime>='2021-05-08 00:00:00' and recordtime<='2021-05-14 23:59:59' 

 

and so on. How can I do this in Alteryx?

4 REPLIES 4
mceleavey
16 - Nebula

Hi @Divyaranga ,

 

If you want to dynamically change these values based on datetimenow(), for example, or by other logic, then you can put your input tool with the SQL script in a macro and feed these values in as control parameters which can then overwrite the value in the SQL script in an action tool.

 

Alternatively, if you would like the user to input these values then you can build an analytic app using the interface tools to update the values in the SQL script from a datetime picker.

 

It depends on the use case.

 

M.

Divyaranga
5 - Atom

Many Thanks. Can I get a workflow for my SQL query using the dynamic input tool. Thanks in Advance

mceleavey
16 - Nebula

@Divyaranga ,

 

you will need to provide your input tool with the SQL script so I can build that for you.

 

M.

Divyaranga
5 - Atom

Sure I will provide the required inputs.

Labels