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: 

use the same command

Solved!
Go to solution

Hello,

 

My VI look like it :

 MYVI

I would like to re-use the same command in my "while".

I have several case and I don't want to creat several text command.

 

If someone kown a trip please tell me how to do.

 

See you,

0 Kudos
Message 1 of 16
(3,140 Views)

That code as written will not work.  You are not making any updates to the string in the loop, therefore you either have a loop that runs once or an endless loop.

 

But if you want to reuse code, then make a subVI and call that VI multiple times.


GCentral
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
Message 2 of 16
(3,123 Views)

The problem using a Sub VI is that I have only one IHM so only one "text command" .

0 Kudos
Message 3 of 16
(3,112 Views)
What is IHM supposed to mean? Your code makes no sense.
0 Kudos
Message 4 of 16
(3,100 Views)

I just want to reuse the same text command several time. Use a sub vi does not help me because I have another window.

0 Kudos
Message 5 of 16
(3,084 Views)

Not really understanding what you're asking for here.  What "text command" are you talking about?  What other "window"?  

Maybe you should post your question in French and let us translate?  Post what you want your code to do and we can probably show you a better way than what you are trying. Smiley Wink

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 6 of 16
(3,076 Views)

Thank for your answer. I think the code I posted shows what I want to do but it's not all the code. My text box ("chaine") is already with others buttons and I don't want to create a sub VI to reuse it.

0 Kudos
Message 7 of 16
(3,040 Views)
Solution
Accepted by topic author Sergreyn

Hi,

 

I maybe not correctly undestand your issue, but you can use a local variable for what you are trying to do...

Paolo_P
Certified TestStand Architect
Certified LabVIEW Architect
National Instruments France

0 Kudos
Message 8 of 16
(3,012 Views)

Ok thank you very much It work; 

MYVI2.PNG

0 Kudos
Message 9 of 16
(3,002 Views)

I don't think you want to do that.

You have introduced a race condition with your local variables.

What you want to do is read your "chaine" terminal in your while loop.

Get rid of your two inner while loops.

Wire "chaine" directly into the case structure.

Make a case for "HI" which lights x>y.

make a case for "Hello" which lights x>y2.

Message 10 of 16
(2,989 Views)