Setting up a count

Error message

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'comment_node_forum_form' not found or invalid function name in drupal_retrieve_form() (line 844 of /var/www/www.gremwell.com/includes/form.inc).

Working on designing a report that in the beginning publishes a count of hosts, services. What is the best way to accomplish a count? Thank you in advance!

Nevermind. Do to a lack of knowledge on part with xpath.

Something like count(//host) should do the trick for hosts. Similar for services.

Alla

I see a lot of structures in the templates of this type:

{{.[count(ipproto/port)=0]|hidden}}

How can I alter these to just see what the count is?

{{count(ipproto/port)}} will show the number of ports.

{{.[count(ipproto/port)=0]|hidden}} acts as condition to display or not to display the rest of the paragraph. If there are no ipproto/port nodes, the count is zero and the paragraph is displayed. Othewise it isn't. "|hidden" is a flag meaning that the expression is executed, but the result is not displayed. It is usefull for changing the scope (what the subsequent expressions will consider the current node in the tree) and for conditional display as in the example above.

That worked for the .odt template but not on the .docx. Even with the "show all formatting marks" option enabled in MS Word, I can't see what's killing the code.

No biggee. I gave up trying to make sense out off MS Office glitches a long time ago.

I'd like to make a table of hosts with a severity count of each type (high/medium/low).

I start a table with {{//host[@status!='ignore']}} in the first column.

Then I add {count(descendant::finding[source-severity='high'])}} to the second column.

Great! I have a table of hosts with their high severity counts. Then, I want to add a medium severity count, so I add another column with {{count(descendant::finding[source-severity='medium'])}}.

I can't get this column to register anything but zeroes. It should count about 70 findings total.

I'm still in the same //host node, right? Is "descendant::finding" correct?

Add new comment

CAPTCHA
Please answer the question to prove that you are not a spammer. If it isn't working and you are not a spammer, please email us.
Fill in the blank.