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.
SOLVED

Automatically Unselect Columns If All Values are Null

pleicht17
7 - Meteor

I'm looking for an automatic way to omit a column if every value is null. I've looked worked with elaborate workflows using transposes, summations, and cross tabs; as well as dynamic select which is where I believe my solution is. I tried using the expression:

 

!IsNull([IsNumeric]) || !IsNull([IsString])

 

but that didn't work. It would be nice to apply that function to all columns rather than include each in an OR statement, but I don't know how to do this.

 

If the input is this:

 

Line ItemInfoIDUPCNote
1i1245  
2i2   
3i3   
4i4
362
  
5i5   

 

then the result would be this:

 

Line ItemInfoID
1i1245
2i2 
3i3 
4i4362
5i5 
5 REPLIES 5
MarqueeCrew
20 - Arcturus
20 - Arcturus

@pleicht17,

 

You asked for it, so here it is.  A new CReW macro that deletes all null columns (of your chosing).

 

CReW-Delete-Empty-Fields

 

Cheers & Happy Inspire18,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
pleicht17
7 - Meteor

Thanks, Mark.

 

 

The macro failed to import. This is part of the window that popped up:

 

failure.PNG

When I click Help > Check For Updates

 

It says "This version of Alteryx is up to date."

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

What version of Alteryx are you on?

 

I am attaching a version that should work on an older version of Alteryx.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
pleicht17
7 - Meteor

This is pretty close. It gives an error that says:

 

Error: CReW Delete Empty Fields 8_1 (2): Tool #21: Parse Error at char(5): Unknown variable "#1"

 

I also found a weird quirk where data that was imported from an excel file showed up as empty if it was a string type and null if it was a numerical type. I didn't get the desired result right away and the Yes (Blanks & Spaces are Empty) toggle didn't work as expected. Not sure if this is a version issue or something else. This may be enough for my needs however because I can probably use the Select tool to change data types for to fix the quirk on real data. Any additional info on the error, these quirks, and the version I'm using is appreciated.

 

I'm on version 11.7.

 

Thank you, this helps a lot.

pleicht17
7 - Meteor

Forgot to mention that despite the error, it still actually worked, so I don't know what that's all about.

Labels
Top Solution Authors