From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
We would probably want the true and false strings to be in quotes. Otherwise, it looks pretty much just like TestStand syntax.
Locals.String = Locals.Pass?"Pass":"Fail"
There are only two ways to tell somebody thanks: Kudos and Marked Solutions Unofficial Forum Rules and Guidelines "Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
I get "%?(pass:fail)s" is based on C syntax, but it seems a bit random considering the other formatting strings.
I think we can all agree on the %. 😁
Why the question mark? For a timestamp, a more detailed specifier is: %<>T. I'd rather see a Boolean specification look like that. You can put text in there, and it's not quoted.
Why the "s"? This letter specifies how the input should be interpreted. All outputs are string, but it specifies the input. An enum can be %s, but then it is actually interpreted as a string (e.g. it has strings). b would be more logical.
I am deeply unfond of putting logic into an embedded syntax language. One objection is just more hiding and obfusication of logic. But the other is that features like this (encoding a downstring string into a control string) inevitably require escape codes and additional syntax that become yet another source of programming error.
I would prefer that this feature never become part of the language so that I do not have to update our style guides to forbid using it.
If LabVIEW is going to do this feature, then It has to be a "b". An "s" indicates that any string or type that can be interpreted as a string could be wired to the terminal and be accepted. Format codes are supposed to be universal to the type being formatted. Since this format code only applies to booleans, it should be a "b" to indicate the limitations of acceptable types. (Whether or not the terminal accepts integers that could be interpreted as "x != 0 => true" is a separate question.)
%s is a promise that this works with string types. This format cannot work with a string type as the input. It doesn't make any sense to have an error message that says that "%s cannot accept a string type" -- it by definition must be able to accept a string type. But an error message "%b cannot accept a string type" does make sense.