06-04-2019 08:16 PM
TestStand 2016 (64-bit) on Windows 10 Pro (64-bit):
Ran across a formatting parameter in Help describing a '%expr' format code under Str() but there is no example provided and nothing was found under Examples.
Anyone have one?? I've attempted several arguments/formats but none seem any more special than what one would expect of '%s'.
The Help text reads as:
Note: Use a format code of %expr to format an expression for display. The expression must be a localized expression. Specify combinations of the following values for parameter 3 to control how the expression is formatted:
0x1 - Format precondition-style expressions into a simpler format.
0x2 - Insert step name comments for expressions that use unique step Ids.
0x4 - Use shorthand for RunState.Sequence.<StepGroup>["step"] in expression.
0x8 - Replace unique step Ids with step names.
Solved! Go to Solution.
06-06-2019 09:52 AM
Str(5.67445000, "%.2f", 1, False) Evaluates to 5.67
Str(5.67445000, "%g", 1, False) Evaluates to 5.67445
I'm not quite sure what you are asking here?
06-13-2019 03:13 PM
If you review the TS help for Str(), you will see another Note about the "%b" format code (usage is same for LabVIEW).
I was following up on this new format code of "%expr". No example was provided.
P.S. Your examples are strictly inline with normal Str() use for the %f and %g format codes.
06-13-2019 04:50 PM
So I think I understand what you are asking a little better. Thanks for clarification.
Expressions are their own unique animal in TestStand. They are C Style syntax as well as you have access to the TestStand functions.
Let's say I have a local variable of type Expression called MyExpression with a value of RunState.Sequence.Main[0].
If I use Str(Locals.MyExpression, "%expr", 0x4, False) the return will be {NameOfStep}.
Whereas if you do Str(Locals.MyExpression, "%s", 1, False) the return will be RunState.Sequence.Main[0]
I guess it just depends on the expression and how you want it visualized.
06-16-2019 12:58 AM
Wow. That's very good. I would never had thought to use an Expression-type PropertyObject directly. I use them, of course, but never considered that specific usage. I was also curious about the descriptions used for Parameter 3 which now make sense.
It's odd, one of the attempts I made was something like:
Str( Evaluate(<existing expressionObject>),"%expr") which looked just like using the %s code (as best I recall now). So close, yet, so far.
Excellent, excellent. 'all hail jigg'!!!
kudos^2
Dave