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

Update constant in SQL query without app

kat
12 - Quasar

I am using the input tool to get data from a SQL database. In the input tool I do some basic filters, to limit the data returned and speed things up. One of the filters is the current month. Normally I then turn this into an app, to dynamically update the data across the different tools. I don't want to use an app in this case, as the user needs to follow along what is happening and has to be able to make changes.

 

Is there a way to make the date within the query dynamic, without doing an app?

4 REPLIES 4
LordNeilLord
15 - Aurora

Hey @kat

 

How dynamic does the date need to be?

 

Does it just need to filter on the current month?

 

You could write your SQL statement to include the following:

AND

DATEDIFF(month, [Your Date Column], GETDATE()) = 0

@LordNeilLord

Part time Tableau, Part Time Alteryx. Full Time Awesome


Data Lover

 

kat
12 - Quasar

Thanks @LordNeilLord, that would work for most cases. This workflow however is run towards then end of and at the beginning of the next month.

 

I'm thinking I could just add my data sources into 2 containers, one using your formula and one having a datediff of 1. Then instead of having to edit the SQL script one would just have to disable one of the containers. Or do you have a better idea?

LordNeilLord
15 - Aurora

Hey @kat

 

In that case I would go for datediff <=1  and have 2 months data in the workflow, which can then be changed?

 

@LordNeilLord

Part time Tableau, Part Time Alteryx. Full Time Awesome


Data Lover

kat
12 - Quasar

Yes good idea, that shouldn't be too much data to have a negative impact on performance.

 

Thank you for the help @LordNeilLord!

Labels