ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

find and replace a single global variable

Hello,

 

I have a GUI which needs to be replicated 10 times. the variables in the global file also needs to be replicated ten times. ex: if GUI1 is using global variables GUI1_TestMode, GUI1_Result etc,  GUI2 should use GUI2_TestMode, GUI2_Result and GUI3 should use GUI31_TestMode, GUI3_Result etc.  So, once I have saved GUI1 as GUI2, I need a way to select all GUI1_TestMode in GUI2 and replace it with with GUI2_TestMode.

 

I tried find and replace in the edit menu, but it finds all the global variables together. 

 

there are about 40 such global variables associated with each GUI and I dont think it will be sane to sit down, rename all of them in the global file, click on each variable and change them.  I really hope I dont have to do that.

 

I am using Labview 8.6

 

Thanks.

0 Kudos
Message 1 of 7
(3,498 Views)

Hi pcs,

 

instead of using 40 globals per GUI with upto 10 different GUIs you really should redesign your program.

 

I would suggest a FGV/AE handling those global data for all of those GUIs…

 

The quick & dirty way would be to use LabVIEW's VI linking scheme:

- Create your global VI with all needed variables. Create your "GUI" and connect it with that global VI.

- Now you copy your GUI to create a new one, this will still be linked to your "global VI".

- Then copy the global VI to create a new instance with a different name ("global2.vi") and ZIP (and remove) the original one.

- When you now open the global2.vi it will search for your orginal "global.vi". Then you simply direct it to use "global2.vi" instead…

- Repeat those steps for all other GUI-VIs…

As said before: QUICK & DIRTY!

Best regards,
GerdW


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

Change the global to a cluster and place it in an array, then you'll have an array of settings/info that's easily handled.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 7
(3,456 Views)

Hi Yamaeda,

 

yes, easily handled - and a lot of race conditions as soon as several of those "GUIs" try to read and write their data at the same time…

Best regards,
GerdW


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

what is FGV/AE ? 

 

I have to actually sit and rename them since they are signals to a PLC and needs to be read back and processed, so I am doing it anyway. 

 

Thanks!!

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

@pcs82 wrote:

what is FGV/AE ?


Functional Globals Variable and Action Engine (I highly recommend following that link and giving the nugget a good read).



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 6 of 7
(3,398 Views)

@GerdW wrote:

Hi Yamaeda,

 

yes, easily handled - and a lot of race conditions as soon as several of those "GUIs" try to read and write their data at the same time…


If capsuled in an AE incl. a Update function which does the reading and writing internally it should help some, but you can always create races. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 7
(3,381 Views)