Filter a custom report

(imported topic written by Harald.Zarakowitis)

Hi,

I like to implement something of a filter functionality in my custom report. I know it can´t be done with the normal filter function.

What I have done is this:

number of applicable computers whose (relevant (it,bes fixlet whose (name of it equals 
"VIE Office")) = 

true) of bes fixlets whose (name of it starts with 
"MS07")

This gives me the number of computers, that are applicable to fixlets starting with MS07 and are also relevant to the fixlet “VIE Office” which is a specific group.

However this takes incredible long. So I wondered if there is another way to do it.

Best regards,

Harald

(imported comment written by jessewk)

Hi Harald,

That’s a nice start, but I do see how it would get really, really, slow with a lot of computers. Also, I think your numbers will be off because you’ll get duplicate computers. Some of the computers will be relevant to more than one MS07 and also relevant to at least one VIE Office fixlet, and those computers will show up twice in the final count.

First, here’s how to do it in 7.0. We added a bunch of inspectors to make queries like yours much easier to write and much more efficient:

size of intersection of (union of applicable computer sets of bes fixlets whose (name of it starts with “VIE Office”) ; union of applicable computer sets of bes fixlets whose (name of it starts with “MS07”))

In 6.0, it’s not quite as elegant, but I think you get what you’re looking for with this query:

number of unique values whose (multiplicity of it > 1) of (unique values of ids of applicable computers of bes fixlets whose (name of it starts with “VIE Office”) ; unique values of ids of applicable computers of bes fixlets whose (name of it starts with “MS06”))

The 7.0 version works as follow:

  1. Take the union of the sets of computers applicable to the “VIE Office” fixlets.

  2. Take the union of the sets of computers applicable to the “MS07” fixlets.

  3. Take the intersection of the 2 sets created in step 1 and step 2, and return the size of the intersection.

The 6.0 version works as follows:

  1. Get the list of unique computer ids that are relevant to at least one “VIE Office” fixlet.

  2. Get the list of unique computer ids that are relevant to at least one “MS06” fixlet.

  3. Merge the 2 lists and pull out the computer ids that are listed more than once in the combined list.

Both techniques work, but the 7.0 version is more efficient and, to me, easier to read and understand. The biggest advantage of the 7.0 version, however, is that instead of ending up with a list of integers (computer ids) you end up with a list of computer objects.

I suspect we’ll start to see all sorts of set, intersection, and union expressions as 7.0 becomes more widespread.

-Jesse