There are cases where you would typically have a singular result but you MIGHT have multiple results in some edge cases.
This came up recently when trying to uninstall an application. In the actionscript:
waithidden msiexec.exe /x { name of keys whose( (exists values "DisplayName" whose(it as string as lowercase starts with "NAME_OF_APP" as lowercase) of it) AND (exists values whose(it as string as lowercase starts with "msiexec") of it) ) of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of ( x64 registries; x32 registries ) } /qn
The issue is that if this relevance returns multiple keys from the registry and thus multiple GUIDs, then the actionscript canât handle that case. This can happen if there is more than one product with a similar name installed, especially if one copy is 32bit and another copy is 64bit.
One option is to just take the âfirstâ result of the many results, uninstall the âfirstâ one, then try again later to uninstall the rest, if desired.
See this example:
Q: tuple string item 0 of concatenations ", " of unique values of ("keyZ";"key1";"key2";"key1";"key3")
A: key1
This will collapse the many results into an alphabetized unique list, then turn that list of unknown number of items into a tuple string, ( example: "key1, key2"
) then take the first item from that tuple string. This works as long as the input strings do NOT contain commas.
One important thing though, is that this ALSO works if there is only 1 result:
Q: tuple string item 0 of concatenations ", " of unique values of ("keyA")
A: keyA
Break it apart to see what happens at each step:
First: Unique List
Q: unique values of ("keyZ";"key1";"key2";"key1";"key3")
A: key1
A: key2
A: key3
A: keyZ
Second: Create Tuple String
Q: concatenations ", " of unique values of ("keyZ";"key1";"key2";"key1";"key3")
A: key1, key2, key3, keyZ
Third: Get first item (0 index)
Q: tuple string items 0 of concatenations ", " of unique values of ("keyZ";"key1";"key2";"key1";"key3")
A: key1
Related:
- Singular expression refers to non-unique object.
- Relevance Tip: Plural vs Singular
- Need Tuple Inspectors, No easy way to convert a plural set of objects into a tuple
- https://bigfix.me/relevance/details/3007530
- Optimizing Bigfix Relevance: Exists
- I get better at writing relevance over time
- https://forum.bigfix.com/c/tips