Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
ned_blog
8 - 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
LisaAdele
5 - Atom

Good Afternoon,

I'm wondering where I can find the macro.

Thank u in advance

Lisa

RodL
Alteryx Alumni (Retired)

Lisa,

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

Rod

LisaAdele
5 - Atom

Found it. Thanks a lot :)