IBM Endpoint Manager, Version 9.2

A boolean expression is required

This error message is produced when a statement requires a boolean value to evaluate, but instead the receives a different type. The Relevance language is strongly typed, and inattention to proper type matching is the source of most bugs. Among other things, a boolean type is required after if and whose statements. For example:

Q: Names of files whose (version of it = "5") of system folder

This example works because the value in the parenthesis is a boolean. Otherwise you get this error, as in this incorrect example:

Q: Names of files whose (version of it) of system folder
E: A boolean expression is required.

Here, the parenthetical statement doesn't evaluate to a boolean, so the expression fails with an error.

The test for an if-then statement must also be boolean. You might think a non-zero number would evaluate to true, but types must be carefully matched, and in the Relevance language, a number is a number, and not a boolean:

 Q: if 1 then "boo" else "hoo"
 E: A boolean expression is required.

One (1) is a number; use a boolean instead:

 Q: if 1=1 then "boo" else "hoo"
A: boo

Which is the same as

 Q: if true then "boo" else "hoo"
A: boo

Along the same lines, you might think to test for an executable file like this:

Q: If regapp "besclient.exe" then version of regapp "besclient.exe" as string 
else "N/A"
E: A boolean expression is required.

Instead, you should check for the existence of the file, which is boolean:

If exists regapp "besclient.exe" then version of regapp "besclient.exe" as string 
else "N/A"


Feedback