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: 

Adding element to string array from front panel design.

Solved!
Go to solution

Hello,

 

I have a project that I need to edit with a VI that has a list of columns (fields) for a database (db) in a string array. The array is shown in the front panel with all the specific db fields already populated. I'm assuming someone put them there when they created the project or added that function. I am able to add an element to the array. However, when I go to exit, it doesn't prompt me to save the changes. And, when I force the changes to be saved, the new element does not show up when I re-open the VI. This behavior is replicated with the NI example (Insert Array Data into DataBase LV 2012 NI Verified.vi) which I've attached.

 

scottadamy01_0-1589572001794.png

 

In the screenshot, the arrow points to the element I added by clicking and typing in the element. When I save the VI, exit and then re-open it, that element is no longer present. How do I add an element to this array and have it save with the VI?

 

Thanks!

 

Scott

 

0 Kudos
Message 1 of 4
(1,984 Views)
Solution
Accepted by topic author scottadamy01

You need to go to Edit >> Make current values default.

 

But changing data and saving it as default in a VI is not a normal use case.

 

Generally if you have data you want to save from one run of a VI to another, your VI will save that data to a file, and will open it when you start the VI.

 

Expecting it to save automatically in the VI is the equivalent of Excel rewriting its exe file every time you add more data to a cell.

Message 2 of 4
(1,951 Views)

Wow. I saw that option in the context menu but didn't think of it doing that. It says "Make current valve default" so I thought it meant make one element all the defaults. I knew it was something fairly obvious I was missing. Thanks for your help!

0 Kudos
Message 3 of 4
(1,884 Views)

And yes, I agree that those value should be saved outside of the VI. I typically program in C# and do the same thing with XML files. This was written by someone who doesn't typically program. So they are basically constants in the app. If I get a chance, I'll be changing that. Thanks again for your help!

0 Kudos
Message 4 of 4
(1,883 Views)