Alteryx Designer Desktop Discussions

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

How to save last 7 days data in table using Alteryx workflow?

technohub
5 - Atom

Hi All,

i am having one requirement, where i am pulling data from DB with some logics and storing it on SQL Server table.

 

i need to implement logic in Alteryx to store only last 7 days data in table, so that Alteryx workflow should check the max date from table column ("DateAdded") and if it is more then seven days, the delete the older data and save the latest data. any ways SQL Server target table should have 7 days data only.

 

Regrds,

AlteryxTech

 

2 REPLIES 2
IraWatt
17 - Castor
17 - Castor

Hey @technohub,

The way I would do this is using the filter tool and only sending the data from the true output with a formula like this:

 

[Date]>DateTimeAdd(DateTimeToday(),-8,"days") 

 

IraWatt_0-1658152116707.png

The community has some quick and easy videos on formulas here Expressions and DateTime-Functions Cheat-Sheet blog  

 

Any questions or issues please ask :)
HTH!
Ira

 

technohub
5 - Atom

Thank you @IraWatt for your quick help.

 

this solution will help to get last 7 days data from source! but my requirement is to maintain 7 days data in target table available on sql server.

we are getting data on daily basis and we are storing that data in target table, but target table should not have data stored for more then 7 days.

Do we have tools which can check the target table data is not having more then 7 days data and if its having then that tool should delete that data. hope this makes my reequipment clear.

Thank you once again.

Labels