LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Update value while running VI

In our application we are using the table of 4 columns 20 rows to store data. The value is written to table of about 10 rows and made it as a default value. while running I update the value in the table but updated value is not stored when we run the VI again. pls suggest me how can I store the updated value permanently.

With regards,
Poornima
0 Kudos
Message 1 of 8
(3,424 Views)
Hi,

What you really have to do is to detect for any changes made to the table, and if changes detected, save the table content at exit.

Please see attached for your reference 🙂

Cheers!
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 2 of 8
(3,412 Views)

@anusree wrote:
In our application we are using the table of 4 columns 20 rows to store data. The value is written to table of about 10 rows and made it as a default value. while running I update the value in the table but updated value is not stored when we run the VI again. pls suggest me how can I store the updated value permanently.


There are a few possible solutions, and it is not entirely clear from the question which one is most appropriate:

(1) You just need to repeat the procedure: After the program stops with the new values in the table, make the current values the defaults again and save the VI. 😉

(2) If you just want to retain the new table values between multiple runs, (without closing the VI in-between), you need to ensure that the table is not initialized or overwritten upon program stop or at the beginning of the next run. Here you just need to design your code accordingly, e.g.place the table terminal inside a case so it is not updated unless the contents change or store it in an uninitialized shift register.

(3) The most reasonable solution would be to store the new values in an external file right next to the VI (e.g. as MyProgramDefaults.ini). This could be automatically updated during the program run and the automatically read at program start. It could be done similar to Ian's solution above.
Message 3 of 8
(3,401 Views)
Thanks all

I am able to store and retrive the changed data by creating a file and storing into the file path mentioned.while we create an exe file of the application, the application will be running in other installed system where it prompts error of file does not exits which is created to store data. Is it compulsory to create a file with file name mentioned in the path while installing in the system.
0 Kudos
Message 4 of 8
(3,391 Views)
You can have the application check if the file exists. If it does not exist, you could program it to automatically create a file with the current VI defaults. This is better than to confront the unsuspecting user with an error message. 😉
0 Kudos
Message 5 of 8
(3,385 Views)
Please also take a look at one of my previous post here

Cheers!
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 6 of 8
(3,381 Views)
Hi,

I am able to store data in creating file as shown in the example FIO_20050623.vi, I noticed that for the first time when we install the VI .First we need to write to file then read from file if we do viceversa the error message pop up saying file does not exits. In our application we are reading the data when installed later changes are made if any then written to the file How could this is solved.

with regards,

Anusree
0 Kudos
Message 7 of 8
(3,329 Views)
There are a few ways to do this, most easily, just check if the file exists (see e.g. if "file info" creates an error).
Now you can disable the read control until write is used for the first time.

First we need to clean up the VI a bit because your design has some problems. Place an indicator in the [i] iteration terminal and you will see that the loop runs at very high speed, consuming all CPU doing nothing.

A much better way is an event structure. Create events for the read, write, and stop button each and fill the appropriate cases.
All the path generation needs to be done exactly once before the loop. Since everything is constant it does not make sense to recalculate it every time a button is pressed. Nothing will ever change. 😉

The attached show a simple implementation (I did not check or modify your file I/O code). Modify as needed.
0 Kudos
Message 8 of 8
(3,320 Views)