This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
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.