Everything outlives its usefulness some day, even categories in Agenda databases, but it is difficult to track down categories to which no items are assigned. True, the Advanced Statistics in the category properties box will tell you how many items are assigned to a category, but for a large database, you would have to display and examine this box for every category.
The "Anyitems" macro is designed to detect "empty" categories and record their names in the note attached to a specially created category. You can then read the category note, or print it and then discard the empty categories which are no longer needed. The macro is long and looks mysterious, but what is does is very simple:
That's all really - there is a little more error checking so that the macro is less likely to go berserk, but in essence it just builds a view for each category, counts the number of items in the view and records this fact in a convenient category note.
There are a few settings in the macro which you can alter to suit your needs. The macro creates and uses a view which hides "inherited" items, so that a parent category will be recorded as empty if no items have been assigned to it directly, even though its children have assignements. You can change this in the macro by changing "Y" to "N" in line 44. You could also, if you wished, have the macro examine date and numeric categories by turning off the test for the type of category.
I hope this is useful
24 January 1992