LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

open different vi based on the username password

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.

Download All
0 Kudos
Message 1 of 7
(3,260 Views)

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)?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(3,244 Views)

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.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 7
(3,242 Views)

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 🙂

 

Example_VI_BD.png

 

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.


GCentral
0 Kudos
Message 4 of 7
(3,180 Views)

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

Ctrl_Val_Set.png

0 Kudos
Message 5 of 7
(3,167 Views)

@Mancho00 wrote:

... or "Start Asynchronous Call" node.



Was that available in LV 2014?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 7
(3,145 Views)

Oops. Forgot to attribute quote to cbutcher.

0 Kudos
Message 7 of 7
(3,140 Views)