04-30-2007 04:16 PM
05-01-2007 02:31 AM
The problem with using variant attributes is that the value is a variant instead of being strictly typed and that you need to use strings as the attribute names. You can get around this by creating a wrapper for each constant, but then it would be much simpler to simply create the VI.
As mentioned, no currently available method is really suitable. The best contender is the subVI const, but those are annoying to create if you have a lot of them. My initial suggestion was a way to get around that annoyance by paying in other areas. If you want security, you can't really use a global as a const, because another developer could decide to write to it, but I think this would be an acceptible risk under certain conditions (although it still far from an optimal solution).
05-01-2007 06:55 AM - edited 05-01-2007 06:55 AM
Message Edited by Ben on 05-01-2007 06:57 AM
Message Edited by Ben on 05-01-2007 06:59 AM
05-01-2007 11:24 AM
Tomi already suggested that and I agreed that creating such an editor is basically a good solution.
@Ben wrote:What if we scripted the sub-VI generation based on a dialog?But how would we easily find and manage them once they were created?
05-14-2007 12:53 PM
LabVIEW, C'est LabVIEW
06-11-2007 02:48 AM
One question here: why can't ring constants be used? They give you a name you can select and several values can be bundled together. If you put the ring constant into a typedef you can configure a nice package of data. The only thing missing is making the typedef constant(?).
Of course then you cannot programmatically change the output of your constant - but then it's not a constant either, but a function (?)
06-11-2007 04:43 AM
The main reason for not using rins is that their value is limited to the integer data types and often you would want your constant to be of other types.
Also, rings do not play as nicely with case structures as enums do.
They do have their advantages, though, and you can use a typedef ring constant. To get it to update its values when you update the typedef, you need to change the data type of the typedef. You can do this by changing its representation and then changing it back. Be sure to use a representation of the same number of bits (or preferably higher) to avoid losing previously configured values.
10-20-2022 03:18 PM
Well, after 15 years I have to ask: Do we have any "official" method to create constants in LabVIEW?
If not, are the Global Variables or subVIs still the recommend solutions?
10-21-2022 05:27 AM
@mthheitor wrote:
Do we have any "official" method to create constants in LabVIEW?
No.
I don't know about recommended, but those options still seem to be the most practical. In practice, it seems relatively rare that I actually need this functionality.