How come this gives me a definite answer:
Q: ((it as trimmed string as version < “2.9.18”) of (following text of first “version” of it ) of lines of files “C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\SSAS\catalog.json”)
A: False
T: 0.513 ms
But when i try to OR them together, it does not:
Q: ((it as trimmed string as version < “2.9.18”) of (following text of first “version” of it ) of lines of files “C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\SSAS\catalog.json”) OR ((it as trimmed string as version < “4.5”) of (following text of first “version” of it ) of lines of files “C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\SSIS\catalog.json”)
E: A singular expression is required.
My goal is to look at the catalog.json file and get the version number and check against a hard value to see if the compute instance needs to be upgraded for Visual Studio extensions.
It’s useful to run these in the Fixlet Debugger, and use the ‘Show Type Info’ option to show the result types. In my case, I don’t get a result at all (the file is not present on my machine), but I can see the type is a 'Plural Boolean"
Q: ((it as trimmed string as version < "2.9.18") of (following text of first "version" of it ) of lines of files "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\SSAS\catalog.json")
T: 0.301 ms
I: plural boolean
Plurals cannot be OR’d together, instead there are a couple of different options you can use.
One method is to consider EXISTS (condition) WHOSE (it=True) By wrapping the plural condition in an Exists clause, a singular is returned
Q: exists (((it as trimmed string as version < "2.9.18") of (following text of first "version" of it ) of lines of files "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\SSAS\catalog.json")) whose (it=True)
A: False
T: 0.267 ms
I: singular boolean
Q: exists (((it as trimmed string as version < "2.9.18") of (following text of first "version" of it ) of lines of files "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\SSAS\catalog.json")) whose (it=True) OR exists ((it as trimmed string as version < "4.5") of (following text of first "version" of it ) of lines of files "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\SSIS\catalog.json") whose (it=True)
A: False
T: 0.393 ms
I: singular boolean
Other operations we could use are ‘conjunction’ or ‘disjunction’. When applied to plural boolean expressions, ‘conjunction’ returns true if all are true (like a serial AND), while ‘disjunction’ gives true if any are true (like a serial OR). Note that between the two clauses I’ve replaced ‘OR’ with the semicolon, making a plural expression out of the two statements.
Q: disjunction of (((it as trimmed string as version < "2.9.18") of (following text of first "version" of it ) of lines of files "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\SSAS\catalog.json") ; (it as trimmed string as version < "4.5") of (following text of first "version" of it ) of lines of files "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\SSIS\catalog.json")
A: False
T: 0.405 ms
I: singular boolean
q: conjunction of (True; True; True)
A: True
T: 0.537 ms
I: singular boolean
q: conjunction of (True; True; False)
A: False
T: 0.430 ms
I: singular boolean
q: disjunction of (True; True; True)
A: True
T: 0.321 ms
I: singular boolean
q: disjunction of (True; True; False)
A: True
T: 0.215 ms
I: singular boolean
That said, the JSON inspectors may have a safer check (in terms of key/value pairs are allowed to split across lines in the JSON format. I don’t have Visual Studio installed on my lab, but there are some good examples of JSON parsing if you search the forum.
Thank you so much! I think this is exactly what I needed. I’m mostly self taught (via experimentation and google), so I had no idea about the “Show Type Information” function. This makes so much sense.
This reworked relevancy worked amazingly, and absolutely makes sense.