LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

type def password

Solved!
Go to solution

Hi all,

 

I want to make a type def or strict type def (not sure which one would do ) for a password, so that if the password need to be updated, I can just change the password in the type def/strict type def and the change would be applied to all existing programs that use the password control/constant?  How?  Thanks!

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 5
(3,086 Views)
Solution
Accepted by topic author jyang72211

You could just put the constant (string) in a vi that only has that, which then would be used everywhere. Changing it would get propogated to all places it is used. Or you could make it a typedef'd enum, retrieving the control's "strings[]" with a property node, for your password comparison. I have put it in encrypted form in a text file, read in at program initialization, allowing me to change it without having to recompile the program. In many environments there is no such thing as a small program change, any recompile, rebuild, whatever requires a rigorous retesting/requalification to absolutely confirm that the program's functionality hasn't changed. That is why I try not to hard-code any constants other than Universal ones, like pi.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



Message 2 of 5
(3,078 Views)

So I cannot just create a numeric controls, key in the password, and set the password as default when I need to change the password?  If I do change the password, the change will not propagate to the old programs?

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 3 of 5
(3,047 Views)

Correct.  A type definition defines only the data type, not the actual value.  You could make a global variable instead and set its default value to the desired password.

Message 4 of 5
(3,036 Views)

You could create a typedef enum, with each value being a password, then in your programs Create a Property Node:Strings[] which will give you the various strings in the enum.  You could then do an "search 1D array" to find a comparison, which will output the index into the string array which matches, or a -1 in none match.The number returned could also be used for "security levels. Encapsulate all of this in a vi that you use through out the program and then updating the enum will propagate to everywhere it is used, if they all point to the same type def. But this does require that you edit code, which as I said before always has risk. There is a temptation while you have the code open to make this change to make that other "small change" and then come the calls from the users in the middle of the night or over the weekend that some part that "you didn't even touch" isn't working.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



Message 5 of 5
(3,027 Views)