We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Delete Records Conditionally and Append in Output tool

bbartol
6 - Meteoroid

I am attempting to output data to a Postgre Database, but I am not sure how to format my output.

I have built a workflow that will run on server nightly to add data to my table, with each run a date is added to differentiate between the data loads. Generally, the nightly load will append to the table in which case I could use the "append existing" output option. There is a scenario where the data may have to get reloaded twice in one day. In this case I want to delete all data from my table tagged with the current date, then readd data to the table.

bbartol_0-1753294988327.png

 

In Alteryx I currently accomplish this task by using an input tool to read the data from the table I am writing to. If table I am outputing to already contains the date associated with my input data, then I filter the matching records from my output table. The output table with matching dates removed is then unioned with my processed input file and the data is reuploaded.

bbartol_1-1753295814508.png

 

This creates a problem where I am always uploading the whole dataset. Is there a way in my output tool to delete data where the dates match the incoming data, then the new data is appended? I want to ensure I never have to reload the entire table.

 

I think I could use a control container to conditionally use this output method and use append in all other scenarios, but there must be an easier way.

1 REPLY 1
binuacs
21 - Polaris

@bbartol use join too to compare your data and connect the output from either R Anchor of the Join tool or L anchor of the join tool based on the your join tool settings. The J anchor shows the matching records which you dont want as your output.

Labels
Top Solution Authors