Mixing Types Boolean and Integer

I have the following relevance that is returning the error: "the right operand of the ‘and’ must have type ‘singular boolean’ (it has type ‘singular integer’ now).

How can I get the check for a relay and the query for a file version to work together?

if exists relay service then (maximum of (if exists file (value of variable “ProgramFiles” of environment & “\BigFix Enterprise\BES Relay\wwwrootbes\bfmirror\downloads\sha1\c2e4dcc2ce4e3cfad844b53cd5847e942fc03814”) then “1703” as integer else if exists file (value of variable “ProgramFiles” of environment & “\BigFix Enterprise\BES Relay\wwwrootbes\bfmirror\downloads\sha1\fa65f9da96841a73c6ed0a4aa92a8596cbab2161”) then “1709” as integer else if exists file (value of variable “ProgramFiles” of environment & “\BigFix Enterprise\BES Relay\wwwrootbes\bfmirror\downloads\sha1\23637F78185AF32F905805396F100CB97A184256”) then “1803” as integer else if exists file (value of variable “ProgramFiles” of environment & “\BigFix Enterprise\BES Relay\wwwrootbes\bfmirror\downloads\sha1\481e839935f81d154cc383b209fa2f185ac02c6c”) then “1809” as integer else “0000” as integer)) else false

So you have to have the same types on both paths of a relevance statement. So you should work your logic to return either both boolean types or both integer types

My logic was wrong anyway. I was trying to find the maximum version cached. I just reversed my search order to look for the highest version first. It is not very elegant, but it will work. I am sure there is a better way.

if exists file (value of variable “ProgramFiles” of environment & “\BigFix Enterprise\BES Relay\wwwrootbes\bfmirror\downloads\sha1\c2e4dcc2ce4e3cfad844b53cd5847e942fc03814”) then “1809” else if exists file (value of variable “ProgramFiles” of environment & “\BigFix Enterprise\BES Relay\wwwrootbes\bfmirror\downloads\sha1\fa65f9da96841a73c6ed0a4aa92a8596cbab2161”) then “1803” else if exists file (value of variable “ProgramFiles” of environment & “\BigFix Enterprise\BES Relay\wwwrootbes\bfmirror\downloads\sha1\23637F78185AF32F905805396F100CB97A184256”) then “1709” else if exists file (value of variable “ProgramFiles” of environment & “\BigFix Enterprise\BES Relay\wwwrootbes\bfmirror\downloads\sha1\481e839935f81d154cc383b209fa2f185ac02c6c”) then “1703” else “none”

That looks like a sticky problem that’s only going to grow. Here’s something that might be a little more readable / easier to scale -

items 1 of ("2e4dcc2ce4e3cfad844b53cd5847e942fc03814", "1809"; "fa65f9da96841a73c6ed0a4aa92a8596cbab2161", "1803"; "23637F78185AF32F905805396F100CB97A184256", "1709"; "481e839935f81d154cc383b209fa2f185ac02c6c", "1703") whose (exists file (value of variable “ProgramFiles” of environment & “\BigFix Enterprise\BES Relay\wwwrootbes\bfmirror\downloads\sha1\" & item 0 of it))

1 Like