Can someone explain "if exists true whose (if true then exists ..."

I understand what the “if exists true whose (if true then exists…” construct is for (avoiding errors caused by objects not existing), but I’d like to understand exactly what it’s doing and why it works. Anyone?

For those who might not understand the reference, consider the following two statements, both run on my Windows computer:

Q: exists packages of debianpackages
E: The operator "debianpackages" is not defined.

Q: if exists true whose (if true then exists packages of debianpackages else false) then packages of debianpackages else "<N/A>"
A: <N/A>

The first one fails and the error will stop a relevance statement in its tracks, while the second (cribbing logic from another HCL-authored relevance) sees that such an object does not exist on Windows yet does not error out.


I think we talked about this in 2017 :smile:

To further expand, the whose clause allows for an error to exist inside of the whose without breaking the entire statement.


It is not too dissimilar to this structure, where the whose just absorbs the error for the folder non-existence

q: version of file "bob.dll" > "3.0" of folder "notexisting\notexisting" of folder "c:\"
E: Singular expression refers to nonexistent object.

q: exists folder "c:\" whose (version of file "bob.dll" of folder "notexisting\notexisting" of it > "3.0") 
A: False
1 Like

And to repeat what I’d said then… “I can’t find it” and “THIS!! This is what I was looking for! Thanks very much, @brolly33!”

Hopefully THIS conversation will come up on future searches for “if exists true whose”…