Counting the number of computers with a specific Analysis value

The code below gives me a count of the number of machines that have the bash patch 126546 applied to them. What I would like is to limit this count to the number of machines that have version 08 of the patch applied. __Bash Revision is the result of an analysis, and returns the 2 digit version number.

< td>Number of computers patched:

<?relevance number of ( (if (exists result (item 0 of it, item 1 of it) and exists values of result (item 0 of it, item 1 of it) ) then (concatenation "%0A" of values of result (item 0 of it, item 1 of it)) else (""))) of ( bes computers, bes property "__Bash Revision" ) ?>

Hi @Bob_K,

If all you want is a count, you can simplify this session relevance quite a bit and filter the count to just those with a specific value with something like:

<?relevance number of values whose (it as string = "08") of results of BES Property "__Bash Revision" ?>

(this assumes you only have one property with the name “__Bash Revision”)

Hi @Aram,

Thanks! That works great for counting…

But, (There’s always a but, right???)

What if I wanted to do the same for this (show the Name, OS, Bash Patch Revision, Up Time and Last Report Time):

<?relevance concatenation of trs of ( ( td of name of item 0 of it & td of operating system of item 0 of it & td of ((if (exists result (item 0 of it, item 1 of it) and exists values of result (item 0 of it, item 1 of it) ) then (concatenation "%0A" of values of result (item 0 of it, item 1 of it)) else (""))) & td of ("126546-" & concatenation "" of values of (results (bes property "Uptime - UNIX", item 0 of it))) & td of ( ( ( year of it as string & "-" & month of it as two digits & "-" & day_of_month of it as two digits ) of date ("est" as time zone) of it & " " & time of time ("est" as time zone) of it as string & " EST" ) of last report time of item 0 of it ) ) of ( bes computers, bes property "__Bash Revision" ) ) ?>

Bob_K

Ah, in that case, I believe something like this might do the trick (I think you meant to concatenate 126546 with the __Bash Revision and not the uptime property, is that right?):

<?relevance concatenation of trs of ( ( td of name of item 0 of it & td of operating system of item 0 of it & td of ((if (exists result (item 0 of it, item 1 of it) and exists values of result (item 0 of it, item 1 of it) ) then ("126546-" & concatenation "%0A" of values of result (item 0 of it, item 1 of it)) else (""))) & td of (concatenation "" of values of (results (bes property "Uptime - UNIX", item 0 of it))) & td of ( ( ( year of it as string & "-" & month of it as two digits & "-" & day_of_month of it as two digits ) of date ("est" as time zone) of it & " " & time of time ("est" as time zone) of it as string & " EST" ) of last report time of item 0 of it ) ) of ( bes computers whose (value of result (bes property "__Bash Revision", it) as string = "08"), bes property "__Bash Revision" ) ) ?>

All that said, is there a particular reason you’re using session relevance for this? (this report output can be achieved very easily through the native Web Reports UI)

Aram,

Yes, I placed the “126546-” in the wrong place (I had cut and pasted a revision before adding that to the code)…

This is exactly what I needed, thanks!

And, session relevance lets me show both the patched and unpatched lists, the unpatched lists using:

bes computers whose (value of result (bes property “__Bash Revision”, it) as string < “08”),

And patched list using:

bes computers whose (value of result (bes property “__Bash Revision”, it) as string >= “08”),

Of course, it also helps me to become a little more familiar with relevance coding, which always helps!

Thanks again,
Bob_K