Application Version Comparison

Hello team,

I am trying to check which machines are installed with the latest version of OLE DB and ODBC. In a machine that I am testing, I have OLE DB 18.6.6 and no ODBC installed.

When I use the following relevance:

Q: ((if (not exists value “DisplayVersion” of it AND not exists value “DisplayName” of it) then “not installed” else (IF (exists true whose (if true then ((exists key whose (((it starts with “Microsoft OLE DB Driver”)) of (value “DisplayName” of it as string) AND value “DisplayVersion” of it as string as version < “19.3.3”) of key “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall” of it) of(if x64 of operating system then (x64 registry) else registry)) else false)) THEN “FOR UPGRADE” ELSE “LATEST”)) of keys whose (value “DisplayName” of it as string as lowercase starts with “microsoft ole db driver” AND value “DisplayName” of it as string as lowercase does not contain “elements” AND value “DisplayName” of it as string as lowercase does not contain “update”) of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of it) of (if x64 of operating system then (x64 registry;x32 registry) else registry)

it would return FOR UPGRADE and switching the version check to < 18.6.6 will return LATEST which would mean that the IF “installed” part of the relevance is working. But when I use the same relevance to check for ODBC (which is not installed to my test machine), it would return LATEST which means that the IF "not installed’ part of the relevance is not being considered?

Thanks in advance for any input

Your ‘Not Installed’ logic will never be true, because of this check…you’re already filtered to keys with specific DisplayName values, so you’ll never reach the case where the ‘DisplayName’ value doesn’t exist beneath the key.

There are a bunch of different ways to accomplish this, I’ll demonstrate just one of them using a ‘set’. I retrieve the registry values as a ‘set’, because an empty set still exists and I can check for a set with size=0 to see that no OLE DB registry key existed; otherwise loop through the members of the set to check the versions

q: (if size of it = 0 then "Not Installed" else (if it as version < "19.3.3" then "Upgrade" else "Latest") of elements of it) of set of (it as string) of values "DisplayVersion" of keys whose (value "DisplayName" of it as string as lowercase starts with "microsoft ole db driver" AND value "DisplayName" of it as string as lowercase does not contain "elements" AND value "DisplayName" of it as string as lowercase does not contain "update") of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (if x64 of operating system then (x64 registry;x32 registry) else registry)
A: Upgrade
3 Likes

Hello Jason,

Thanks for explaining further why the not installed logic was not working.

I was seeing the ‘set’ on other relevance statements but didn’t know that it can be used this way so this one is very helpful!

Thank you very much for the help! :slight_smile: