Relevance to aggregate number of results

Hi everybody, starting from this relevance

((names of computers of it, statuses of it) of (results whose (value of results (bes property "myproperty",computers of it) = "True"and name of computer of it = "mycomputer") of it) of member actions of it) of bes actions whose (id of it = 12345)

which return 4 row

mycomputer, waiting
mycomputer, pending restart
mycomputer, pending restart
mycomputer, fixed

I would instead obtain

mycomputer, number of results (4), number of results without waiting (3)
so
mycomputer, 4, 3

Any help?
Thanks a lot

I’d convert statuses to string, and then use multiplicity of unique values to extract the stats you are after. You may have to iterate through the list of statuses twice to get the different filters but it should be relatively inexpensive thing to do. I faked it by just creating the list of statuses for testing but should give you an idea how to do it:

q: ("mycomputer", sum of (multiplicity of it) of unique values of ("waiting"; "pending restart"; "pending restart"; "fixed"), sum of (multiplicity of it) of unique values whose (it != "waiting") of ("waiting"; "pending restart"; "pending restart"; "fixed"))
A: mycomputer, 4, 3
T: 0.472 ms
I: singular ( string, integer, integer )
4 Likes

Unfortunately, it doesn't work, the result I get with the relevance I used as an example and modified with your suggestions is
mycomputer, 1, 1
mycomputer, 1, 1
and so on...

Try something like:

((names of computers of it, sum of (multiplicity of it) of unique values of (it as string) of statuses of it, sum of (multiplicity of it) of unique values whose (it != "waiting") of (it as string) of statuses of it) of (results whose (value of results (bes property "myproperty",computers of it) = "True"and name of computer of it = "mycomputer") of it) of member actions of it) of bes actions whose (id of it = 12345)

or if that doesn’t work, see to put a level of obstruction in front of it:

((item 0 of it, sum of (multiplicity of it) of unique values of elements of item 1 of it, sum of (multiplicity of it) of unique values whose (it != "waiting") of elements of item 1 of it) of (name of computer of it, set of (it as string) of statuses of it) of (results whose (value of results (bes property "myproperty",computers of it) = "True"and name of computer of it = "mycomputer") of it) of member actions of it) of bes actions whose (id of it = 12345)

Thanks @ageorgiev but no way: both have the same result
mycomputer, 1, 1

you need to restructure the incoming result set then. I don’t have those jobs and properties to make it work but if you get it to - computer, set of string statuses then the above should work.

1 Like

Thanks again, that’s what I’m trying but I’m banging my head :sob:

Try following & modify accordingly:

I dont have “myproperty” :wink: hence used mine property.

Q: ("MyServer", concatenation ", " of ((it as string & "=" & multiplicity of it as string) of unique values whose (it as string != "Waiting") of (it as string) of statuses of (results whose (value of results (bes property "BES Relay Service Installed", computers of it) = "BES Root Server" and name of computer of it = "MyServer") of it) of member actions of bes action whose (id of it = 470119)), sum of (multiplicity of it) of unique values whose (it as string != "Waiting") of (it as string) of statuses of (results whose (value of results (bes property "BES Relay Service Installed", computers of it) = "BES Root Server" and name of computer of it = "MyServer") of it) of member actions of bes action whose (id of it = 470119))
A: MyServer, ( Fixed=1, Not Relevant=13 ), 14

Sets are indeed the path. Try this?

Notice I expand the Computer set first, so I can get “per computer”
There might be an efficiency issue with not expanding the member actions lower down in the tuples but my lab is down so I cannot test it at the moment.

(
name of item 0 of it
, number of results (item 0 of it, member actions of elements of item 1 of it)
, number of results (item 0 of it, member actions of elements of item 1 of it) whose (it as lowercase != "waiting")

) of (
elements of item 0 of it
, item 1 of it

) of  (
set of computers of results of elements of it
, it
) of set of bes actions whose (id of it = 12345)

And after picking at it a little longer, I realized that since the Action at the bottom is singular, you can do it without sets and just a bit of tupling. The real trick is teasing out the computer list early, but not expanding the member actions until late.

(
name of item 0 of it
, number of results (item 0 of it, member actions of item 1 of it)
, number of results (item 0 of it, member actions of item 1 of it) whose (it as lowercase != "waiting")
) of (
computers of results of it
, it
) of  bes actions whose (id of it = 12345)
5 Likes

Thanks brolly, you give me the right hint and it works
a little correction
number of statuses of results (item 0 of it, member actions of item 1 of it) whose (status of it as string as lowercase != "waiting")

Many many thanks! :wink: