First, set up a view so the categories and counts are there. In the view, column 1 should be categorized. Column 2 should have a value of 1 (numeric, formula) and set to include totals with detail rows hidden. Now, you can use these two Evaluate statements in your LotusScript agent to find out how many documents are under a certain category:

CategoryNames = Evaluate({@DbColumn(""; ""; "Categorized"; 1)})

CategoryValues = Evaluate({@DbColumn(""; ""; "Categorized"; 2)})

The variable CategoryNames now has an array of all the category names, and the variable CategoryValues has an array of all the values. You can then loop through the category names to find the one you want - the corresponding entry from CategoryValues will be the number of documents under that category. Note that CategoryValues actually has one more array element. The last array element will contain the sum of all the categories. If you know all the documents in the view only fall in one category each, then this number is the total number of documents in the view (this provides a quick way to get at that value).