From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string command

Solved!
Go to solution

Hello gents, I would like to ask how I can give or not a command with a string (text): if I enter (or select)  'OK' my subVI will run, if I enter (or select) 'FAILURE' my subVI will not execute its tasks. Thanks in advance.

0 Kudos
Message 1 of 11
(2,703 Views)

Hi Edmond,

 


@EdmondDantes wrote:

if I enter (or select)  'OK' my subVI will run, if I enter (or select) 'FAILURE' my subVI will not execute its tasks.


In LabVIEW a case structure is used to implement this typical pseudocode:

IF condition THEN
  do something
ELSE
  do something different
ENDIF

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(2,695 Views)

I understand, but a user (who knows the result of an external test,but who doesn't know how my VI works) is supposed to select or to text "OK" or "FAILURE" and according to this condition a subVI will execute or not.

So, can the condition of this case structure be a string or a select of "OK" or "FAILURE"?

0 Kudos
Message 3 of 11
(2,684 Views)

Hi Edmond,

 


@EdmondDantes wrote:

So, can the condition of this case structure be a string or a select of "OK" or "FAILURE"?


Why don't you read the LabVIEW help for case structures? It explains all datatypes the case structure can handle at its selctor input…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 11
(2,679 Views)

ok, THANKS.

May I just ask you how to create a control display that can make me select 'OK' or 'FAILURE', so that I can send the condition to the case structure. I tried with text ring control and with combobox control but I didn't success.

0 Kudos
Message 5 of 11
(2,644 Views)

Hi Edmond,

 

create a boolean button, then enable booelan text for both states, then use "OK" and "FAILURE" for boolean text…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 11
(2,641 Views)

Hello Endmond,

what and how did you do so far? Can you attach a (simplified) VI showing your not working solution?

 

Greets, Dave
0 Kudos
Message 7 of 11
(2,622 Views)

I cannot attach the subVI, but I can explain in details the situation:

I'm dealing with some tests, if the test successes (and the user knows it), the user has to enter or select 'OK' (as a text/string) and then, through the case structure, I will tell the subVI to not execute cause it is not needed.

On the other hand, if the test fails I have to calculate with this subVI some parameters: the user has to enter or select 'FAILURE' to tells the subVI to execute. 

But I'm not familiar with string, so I cannot how to manage boolean text and stuff. I have the clear idea in my mind, but I don't know how to move the first steps. 

0 Kudos
Message 8 of 11
(2,616 Views)

Hi Edmond,

 


@EdmondDantes wrote:

the user has to enter or select 'OK'  …  if the test fails … the user has to enter or select 'FAILURE' to tells the subVI to execute.


Put two buttons on your frontpanel and label them "OK" and "FAILURE". The user clicks one of them.

Use an event structure to detect which button is pressed…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 11
(2,612 Views)

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
Learn LabVIEW

0 Kudos
Message 10 of 11
(2,606 Views)