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 Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
FlavioPuhl

Store data values to the next VI initialization

Status: Declined

Any idea that has received less than 4 kudos within 4 years after posting will be automatically declined.

When we run a VI and change the control values  so when we close that VI and open again, the default values are loaded instead of the values from previous run.  My proposal is to have two options to the control values:

 

1. Initialize with default values (OK, it is what we have today)

2. Initialize with last value

 

So, if you have a VI with tons of controls and have to stop the work for a while, the next time that you open the VI again that control values will be there and not the default values.

 

 

Skype: flavio.luiz.puhl.junior
8 Comments
altenbach
Knight of NI
This means that the vi is "dirty" affter each run, and needs to be saved. That's not good. There are plenty of workarounds derscribed in ther LabVIEW forum, so I don't think we need this.
FlavioPuhl
Member

No, this feature apply to the executable version.  Most of the programs that we use today has this feature as default.

 

Today, to perform this function, I have to read ALL controls and store the data in a txt file. On the next program initialization I have the read this txt and allocate the data in the correct control.

 

Its a huge and boring code...  Would be so simple with LabVIEW has this option to memorize last value automatically..

Skype: flavio.luiz.puhl.junior
altenbach
Knight of NI

Well, in order to "memorize", the state of all controls needs to be saved somewhere. It needs to be in a location where the program has write access. Should it be on a "per program" or a "per user" basis? What if the previous operator stored really bad values as new defaults, should there be an easy way to revert?

 

Should it only memorize when the program is closed normally or should it update the defaults whenever the value changes, so the latest values are retained even if the computer crashes?

 

I still think the right way would be to use an ini file that your application manages yourself. It would be difficult to find a solution that fits all possible scenarios.

 

rgvdh@rdf
Member

>I still think the right way would be to use an ini file that your application manages yourself.

 

Then there should be a really easy way of programattically saying "Take the current value of everything on the front panel and store it in this ini file."  Maybe there is, and I just haven't understood ini files well enough ....

FlavioPuhl
Member

I agree with you, rgvdh@rdf...

 

The ini files works well, but you still could have huge code just to save the value.  Now, for example, I am having a lot of trouble to save the data from a Multicolumn Listbox in a INI file..

Skype: flavio.luiz.puhl.junior
dthor
Active Participant

If you have and use OpenG (which you should, 'cause it's awesome), it takes one subVI to write the entire front panel to a file. It takes one subVI to read an entire front panel from a file.

 

It is *not* a lot of code to implement, not at all.

 

I would attach the VIs in question, but they have a ton of dependencies.

 

Here's what the code looks like:

Read anf Write FP to file.PNG

 

And the config file:

[Untitled 1]
Numeric = "0.000000"
Array = "<size(s)=0> "
Path = ""
Boolean = "TRUE"
String = "cvgdf353"
Enum = "apple"
Cluster.Numeric = "0.000000"
Cluster.Boolean = "FALSE"
error in (no error).status = "FALSE"
error in (no error).code = "0"
error in (no error).source = ""

(EDIT: Formatting and spelling)

altenbach
Knight of NI

Well, the idea per se is not bad, and maybe it should be incoprorated into plain LabVIEW in some form.

 

In the newest LabVIEW version we can already separate the compiled code from the VI, so what would it take for a similar mechanism to "separate the default data (or "last", if desired) control values from the VI"??? See what I am gettting at?

 

Of course this needs to be implemented in a way that it works well for built applications and I don't know what that would involve....

 

I will give kudos with some reservations. 😄

Darren
Proven Zealot
Status changed to: Declined

Any idea that has received less than 4 kudos within 4 years after posting will be automatically declined.