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.

SQL query for most recent report

Clark-
5 - Atom

Hello community, I'm looking for a solution for a SQL query I am building to pull in daily wire reporting.   I would like to have an automated solution built to pull the report on a daily basis, reformat, and email to selected group; however, since I am very new to this I am hitting a road block on the Report date.  Is there way to write the query so that it pulls the most recent posted report without me having to manually update the date?  Here is what my query looks like: 

 

select wire_detail1.Report_Date,
wire_detail1.PLAN_NUMBER,
wire_detail1.WIRE_AMOUNT,
wire_detail1.WIRE_RECEIVE_DATE,
wire_detail1.WIRE_EXPECTED_AMOUNT,
wire_detail1.OBI_LINE1_NAME,
wire_detail1.OBI_LINE2_NAME,
wire_detail1.OBI_LINE3_NAME
from InfoPac_DCOPR.managed.wire_detail wire_detail1
where wire_detail1.Report_Date = '06/07/2021'
and wire_detail1.PLAN_NUMBER = 66666

 

Thank you 

2 REPLIES 2
BrandonB
Alteryx
Alteryx

The Dynamic Input tool is what you will want to use. You can use a formula tool with a datetimetoday() function that pulls in today's date. Then you probably want to use a DateTime tool to put it into the desired format. Then followed up with a Dynamic Input tool that replaces the date in your where clause would do the trick. 

apathetichell
18 - Pollux

You can consolidate with:

 

datetimeformat(datetimetoday(),"%m/%d/%Y")

 

 

if you want a format like "06/09/2021"

Labels