LabVIEW Idea Exchange

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

Change Output Representation on "Boolean to (0, 1)"

Status: New

I16 is currently the only output representation of this function, and it is particularly unhandy - I typically end up typecasting it 90% of the time. I propose the output representation of this primitive can be changed via Right-Click Menu.

 

BoolOutputRepresentation.png

3 Comments
Broken_Arrow
Active Participant
I wonder why NI chose to make that output signed anyway? Great idea BTW.
Richard






altenbach
Knight of NI

I am all for it! I bugged NI about this numerous times in the far, and not so far, past. 😉

 

The right-click menu is nice, but a bit nonstandard. A more normal way would be to have an output configuration in the properties menu, as for most other primitives these days. Maybe we should have both. 😄

 

In addition, the output should be I32 by default. I16 is probably a remnant from ancient times where memory was precious. Why I32? I32 is the prototyical integer used for most (iteration counts, index, for loop N, etc.), so it will be "right" in the majority of cases.

 

A typical use is to do a comparison on an array, covert the boolean array to integer, and sum to determine N for a FOR loop. I16 is dangerous, because unless we convert to I32 before summing, we might easily overstep the valid range.

kegghead
Member

Just found this idea again via a link from another idea. I'd argue it would be better for the output of this primitive automatically adapted to the downstream numeric type without the need to choose the representation. This behavior does exist on a few special nodes, the Variant To Data for one.