community
cancel
Showing results for 
Search instead for 
Did you mean: 

Engine Works Blog

Under the hood of Alteryx: tips, tricks and how-to's.
Asteroid

I have gotten the question of how to count records in a stream. The simplistic answer is to use a summarize tool. That works in most situations, but the summarize tool doesn't output any records if no records come in. It does seem like a valid request to be able to get a 0 count of records, because you might want to put something on a report that says "N Unmatched Records" and sometimes N is 0 and you want to know about it. After being asked 1 more time, I decided to throw together a simple macro to do it. You can find it in Alteryx post v 5.0.

 

How does it work? Very simple.

 

The macro takes your input and then runs a summarize tool. It also has text input that supplies the count of 0. I union together the count from the summarize & the text tool and then take the 1st record. If the count is >0 than the summarize tool produces a record and that is the one that is output. If there are no records coming in, then the dummy record showing the 0 count from the text tool gets output. Either way the macro outputs a record, even if there were none in the input. Another good example of how powerful macros can be - even simple ones.

Comments

Good Afternoon,

I'm wondering where I can find the macro.

Thank u in advance

Lisa

Alteryx Alumni (Retired)

Lisa,

It is part of the standard install...in the Transform category of tools.

Rod

Found it. Thanks a lot Smiley Happy

Labels