LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
JimChretz

Add boolean text specifier in format into string

Status: New

I wish there was a boolean text specifier for Format into String functions.

 

% followed by "?" would expect two possible strings like this. Why not?

 

boolean.png

19 Comments
wiebe@CARYA
Knight of NI

Well, I coined the %b myself, so I'm not going to argue (much) 😁.

 

That is sound reasoning...

JimChretz
Active Participant

Currently LabVIEW rerturns no error if we have a string connected to the terminal like this:

JimChretz_0-1667829515566.png

 

wiebe@CARYA
Knight of NI

Pretty much everything between < and > in a format specifier seems to be ignored, except for %<>T, where it is actually used:

wiebeCARYA_0-1667920700683.png

wiebeCARYA_1-1667920716373.png

 

I think that helps this cause... It makes this adjustment an extension, without having to change how things work.

Yamaeda
Proven Zealot

There already is: %s.

 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
srlm
Member

Yamaeda: %s doesn't let you specify the strings, which is the request. The idea is essentially a trinary operator buried in the format string. 

AristosQueue(NI)
Member

I’m with Darren on this. Putting more computation into the format string is something I oppose generally. Why? Harder to debug, easier to hide strange behaviors, harder syntax to read, and not directly discoverable to write. When the alternative is directly and easily expressed on the diagram, as Darren shows, I see mostly downsides to more format syntax. 

wiebe@CARYA
Knight of NI

But the plain solution doesn't allow dynamic formatting .

 

If the formatting comes from the user or other external recourse, you're screwed.

 

Not implementing this because it's harder to read (only when you use it), is actually causing code to be much, much (much) more complex.

 

If this was implemented, you can still choose to not use it because it's harder to read. If it's not implemented, you don't have a choice.

JimChretz
Active Participant

The syntax apparently already exists, instead of ignoring the code between angle brackets LabVIEW should use it, the code below should output "Pass".

JimChretz_0-1671636762533.png

 

wiebe@CARYA
Knight of NI