11-24-2015 10:15 PM
I am writing a new ini file and i want to include an equivalent of enums in my ini file.
For example:
enum Fault(0="Inactive", 1="Active", 3="Latched") where Fault is a 2 bit data. This 'Fault' i will then be using as a 'SignalType' instead of 'Int'. As a result when i view the result of a fault, i need the value to be displayed as 'Inactive' or 'Active' or 'Latched' instead of 0,1 or 3.
Is this possible or will i only get 0,1 or 2 and i will have to interpret the values myself?
11-25-2015 01:23 AM
@PoonamA wrote:
I am writing a new ini file and i want to include an equivalent of enums in my ini file.
For example:
enum Fault(0="Inactive", 1="Active", 3="Latched") where Fault is a 2 bit data. This 'Fault' i will then be using as a 'SignalType' instead of 'Int'. As a result when i view the result of a fault, i need the value to be displayed as 'Inactive' or 'Active' or 'Latched' instead of 0,1 or 3.
Is this possible or will i only get 0,1 or 2 and i will have to interpret the values myself?
I don't understand how this has anything to do with LabVIEW. Perhaps if you explained why you feel this needs to be in an ini file and not in the code itself, we could better help you?
To me, something like this is not likely to have different values in different applications, so it would be something I would not put in an ini file. If the definition needs to be consistent across your apps, maybe it should be an typedef'd enum in a library. That way if you change the typedef, all the copies get updated as well. (And if you did your coding correctly, your code would break in all the places you where you need to update your code and auto-update where you don't, eliminating guesswork.)
11-25-2015 04:04 AM
Have you tried using the OpenG Variant Config Tools? They work with enums.
11-25-2015 04:32 AM
Thank you for the reply, but i think i was not clear in stating the problem or maybe i posted this doubt in the wrong forum.
I will be importing ini files in Teststand and these ini files contains definitions of CAN messages. I just wanted to know if there is any equivalent of 'Enum' which can be used in writing ini file, and if there is, how to use it?
11-25-2015 06:19 AM
I'm not sure with TestStand, but in LabVIEW, I just use the string equivalent in the ini files. I then read the key as a string and use Scan From String to get the enum.
You could make a VI to read the ini file and output the values to TestStand.
11-25-2015 07:08 AM
I see - that was rather dumb of me. You wanted to store the enum itself, not the values! I guess that's what I get for patrolling the forums after my bedtime. 😄
11-25-2015 08:25 AM
take a look at the image.
good luck.
11-26-2015 08:40 PM