Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

save output if columns have value

Sshasnk
8 - Asteroid

Hi I have a dataset and I have to save it only if it has value and if the data is not there then I should not overwrite the old data

 

Example:

Scenario 1.

In the below condition we should overwrite yesterdays file because it has value

 

nameplacecity
jamesUKlondon
ClarkUSANY

 

Scenario 2.

2nd a scenario where all the columns are empty, here I should not overwrite it

 

nameplacecity
   
   

 

Scenario 3.

 

3rd scenario everything is null, here I should not overwrite it

 

Note: In Scenario 2 and scenario 3 I should get an error message and stop the canvas

 

4 REPLIES 4
patrick_mcauliffe
14 - Magnetar
14 - Magnetar

@Sshasnk I like to use the Transpose and Crosstab tools for things like this.

First, if your data doesn't already have a row number, add one with the Record ID.

Then, transpose your data so it is in Name:Value pairs

patrick_mcauliffe_0-1634036214551.png

 

Then, use a filter, to remove any rows where the  Value is empty

 

patrick_mcauliffe_1-1634036258660.png

 

Next, group by the Name field and this will be the names of the columns that had data in them.

 

patrick_mcauliffe_2-1634036298721.png

 

Next, join that list of names to the data after it was Transposed.

Be sure to remove the duplicate field.

patrick_mcauliffe_3-1634036345146.png

 

Now, you can use the Crosstab to get the data back into the format it was before we moved things around.  This is what you would use to overwrite data.  If there is no data, then nothing to overwrite.

 

patrick_mcauliffe_4-1634036398538.png

 

Sshasnk
8 - Asteroid

it will still overwrite and you will get empty values in your column

patrick_mcauliffe
14 - Magnetar
14 - Magnetar

Can you post your workflow?  I must not be understanding your description.

mceleavey
17 - Castor
17 - Castor

@Sshasnk ,

 

Use the Message tool and the Count Records tool.

 

mceleavey_3-1634040759167.png

 

 

This will give a count of records present. Simply attach this to the Message tool and configure as follows:

mceleavey_1-1634040653766.png

 

This will throw an error and tell you there are no records present.

mceleavey_2-1634040688063.png

 

Hope this helps,

 

M.

 



Bulien

Labels
Top Solution Authors