02-06-2020 12:52 PM
I am new to the world of programming. Kindly pardon. I wish to have 2 set of username password and based on the combination of the username password I want the respective vi's to be opened.
For example, username = add and password = plus should open add.vi
whereas username = sub and password = minus should open sub.vi
Herewith, I am attaching a sample login.vi and the other respective vis here. I kindly request someone to guide me through. Screenshots or LabVIEW 14 vi will be largely appreciated.
02-06-2020 01:21 PM
Hi Diaspora,
@Diaspora wrote:
I wish to have 2 set of username password and based on the combination of the username password I want the respective vi's to be opened.
For example, username = add and password = plus should open add.vi
whereas username = sub and password = minus should open sub.vi
So you want to implement this pseudocode:
IF user == "add" AND pswd == "plus" THEN
call "add.vi"
ENDIF
IF user == "sub" AND pswd == "minus" THEN
call "sub.vi"
ENDIF
What is the problem to implement two simple comparisons with string constants and a basic boolean operation followed by a case structure (which implements the IF-THEN-ENDIF statement)?
02-06-2020 01:26 PM
You could have a table in your lookup file that has the user name, password, and VI to call each in their own columns. Do a simple search for the user name to get the row you need. Then you have the password to check against and the name of the VI to call. You could then use Open VI Reference and an Invoke Node to run the VI that is allocated to the user.
02-07-2020 07:27 AM
This should work for you.
I didn't implement it in terms of the config, because
a) you didn't provide a config file
b) I thought that might be an example file that you didn't necessarily want to use
c) you can implement it in terms of the ini if you'd like 🙂
These open the VIs and run them, but don't allow passing arguments (you didn't have any connector panes anyway).
If you wanted to instead pass values into your VIs, you'll need to define a connector pane (ideally a common connector pane, or else you'll need to handle different cases explicitly) and then use the Open VI Reference with a "type specifier refnum" (top input) and Call by Reference or "Start Asynchronous Call" node.
02-07-2020 09:21 AM
If you wanted to instead pass values into your VIs, you'll need to define a connector pane (ideally a common connector pane, or else you'll need to handle different cases explicitly) and then use the Open VI Reference with a "type specifier refnum" (top input) and Call by Reference or "Start Asynchronous Call" node.
Or we could use some of these before the Run VI invoke node
02-07-2020 02:05 PM
@Mancho00 wrote:
... or "Start Asynchronous Call" node.
Was that available in LV 2014?
Ben
02-07-2020 02:15 PM
Oops. Forgot to attribute quote to cbutcher.