RestAPI Nested Relevance

Hello,

I am working on a script that uses the RESTAPI.
I need to create a relevance that combines the following ones.
Basically I’d like to get all the computers in a group and return only the computers with a specific property value.

names of (members of bes computer groups whose(name of it as lowercase as trimmed string = “My Group” as trimmed string as lowercase))
names of computers of results whose(exists values whose(it contains “ValueProperty”) of it) of bes properties “Property”

Thanks in advance for your help.

Probably not complete or efficient, but maybe try tuple comparisons -

names of computers of items 1 of (member set of bes computer group whose (name of it = "My Group"), results whose(exists values whose(it contains "ValueProperty") of it) of bes properties "Property" ) whose (computer of item 1 of it is contained by item 0 of it)

or, rather, some mutation of this may be more efficient:

names of computers of results whose (exists values whose (it as lowercase contains "my value") of it and (computer of it is contained by member set of bes computer groups whose (name of it as lowercase = "my group")))of bes properties "my property"

If you have two collections of strings you can turn them into string sets and use the intersection operator:

intersection of (set of (relevance that checks groups);set of (relevance that checks property))

You can also probably just combine your statements (I haven’t tested this – EDIT: JasonWalker took the liberty of testing and correcting this below):

(members of bes computer groups whose(name of it as lowercase as trimmed string = "My Group" as trimmed string as lowercase)) whose ((exists values whose(it contains "ValueProperty") of it) of properties "Property" of it)

Very close, but leaving out “results” of properties. I just tested that as

names of (members of bes computer groups whose(name of it as lowercase as trimmed string = "my group" as trimmed string as lowercase)) whose ((exists values whose(it as lowercase contains "my value") of it) of results (bes property "My Property", it))

Thanks for your help. I am not very familiar with that syntax.
This one seems to work for me.
names of computers of items 1 of (member set of bes computer group whose (name of it = “My Group”), results whose(exists values whose(it contains “ValueProperty”) of it) of bes properties “Property” ) whose (computer of item 1 of it is contained by item 0 of it)
Not sure what the “of items 1” means though…
The intersection seems interesting but returned Error: The operator “intersection” is not defined.

Thanks,

Can you share what you tried and I can see where it may have gone south?

The intersection should result in much simpler relevance for what your trying to do so it may be worth trying to get it to work.

Thanks, I appreciate the help :
intersection of (set of (names of (members of bes computer groups whose(name of it as lowercase as trimmed string = “Group1” as trimmed string as lowercase)));set of((names of computers of results whose(exists values whose(it contains “Auto”) of it) of bes properties “Type”)))

I get the error : Error: The operator “string” is not defined.

Sorry to budge in on your discussion. I went back to the original question, and you might be just looking for a group of computers with certain properties?

This is a form for combining BES Property and BES Computer:

results 
from
    (bes property) 
of
    (bes computers)

So an example would be the following, which returns all the computers in a group “Clifden Site” that are Servers.

names of computers of results 
from
    (bes property whose (name of it = "Device Type")) 
whose 
    (value of it = "Server")
of
    (members of bes computer group whose (name of it = "Clifden Site"))


4 Likes

So for the two pieces we can simplify

1:

(names of members of bes computer groups whose (name of it = "Group1"))

2:

(names of computers of results whose (value of it contains "Auto") of bes properties "Type")

1&2:

elements of intersection of (set of (names of computers of results whose (value of it contains "Auto") of bes properties "Type");set of (names of members of bes computer groups whose (name of it = "Group1")))

or

elements of intersection of (
  set of (names of computers of results whose (value of it contains "11") of bes properties "ID");
  set of (names of members of bes computer groups whose (name of it = "All Managed Devices"))
)
1 Like

I wish I could “like” this post twice.

1 Like