Where to place the whose clause

In the relevance statement below, this will show the name of the action, and whether the action script contains the word wizard, for computers whose names contain mtm012.

((name of it, action script of it contains “wizard”) of action of it ) of action results of bes computers whose (name of it contains “mtm012”)

Now, if I wanted to show only the names of the actions that their action script contains “wizard”, where would I place:

whose (action script of it contains “wizard”)

??

Thanks,
Bob_K

The relevance parser can get a bit confused when putting a whose inside a new tuple. You can either add the filter after you’ve created it, or ‘next to’ the tuple to modify it.

First, we remove the contains code, leaving your unfiltered results

((name of it, action script of it) of action of it ) of action results of bes computers whose (name of it contains "mtm012")

The we add the filter ‘whose’ just after the tuple, so the whose will refer to the tuple pair and needs to request ‘item 1 of it’ to make the filter act on the action script results.

((name of it, action script of it) whose (item 1 of it contains "wizard") of action of it) of...

Alternately, you can add add the whose after the “action”, but then you need to ask for the action script again, as at that point you only have the action objects…

((name of it, action script of it) of action whose (action script of it contains "wizard") of it) of...

…or add an extra IT and place the whose afterwards.

((name of it, action script of it) of it whose (action script of it contains "wizard") of action of it) of...
2 Likes

@Bob_K its one of those things that I had trouble learning and figuring out, but now I do it without thinking, but I’d have trouble explaining it like @jwilkinson did.

In general, the flow of relevance evaluation is from right to left (And I recommend keeping it that way as much as possible), but the whose statement is a filter that appears on the right but affects what is on the left.

I’ll take a simpler example so I can keep it straight:

In all of the following examples, it refers to regapps

  • First get the relevance to return the thing you want to filter by:
  • names of regapps
  • Then put that in a whose statement, with it replacing the original
  • names of regapps whose(“BESClient.exe” = name of it)
  • Then either check for existence, or do further evaluation / filtering / manipulation:
  • exists regapps whose(“BESClient.exe” = name of it)
  • You can actually make the flow more right to left by changing the relevance this way: (this is probably more confusing, but I recommend this approach if you have a very complicated whose statement)
  • it whose(“BESClient.exe” = name of it) of regapps

This is an oversimplified example, but you can break up a compound whose clause like this:

it whose("BESClient.exe" = name of it) of it whose(name of it ends with ".exe") of regapps

Which should be equivalent to:

it whose(name of it ends with ".exe" AND "BESClient.exe" = name of it) of regapps
2 Likes

And use Fixlet Debugger if you can! If you click on the “it” when you have multiple it’s you can see which it it is (say that 5 times fast)

1 Like

Presentation debugger will do the it highlighting thing as well.

2 Likes

Thank You.

And to think I wasn’t going to post this because I thought it was too basic a question…

Bob_K

1 Like

It is pretty safe to assume that if you don’t get it, particularly if you’ve tried to research it on your own, then many others will have the same issue.

In my example, this code will error if the key does not exist. Can whose/it be used to check existence instead of if/then for a cleaner relevance?

value "InstallDate" of key "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\VisioStdXVolume - en-us" of (x64 registries;x32 registries) as time < now - 5*day

Sure, a whose () clause combined with plural properties should do it. Don’t have a debugger handy, but I think this should work.

exists keys "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\VisioStdXVolume - en-us" whose (value "InstallDate" of it as string as time < now - 5 * day) of (x64 registries;x32 registries)

That seems to work. Thank you! I need to learn how to use those…