LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

saved data in string on front panel

hi, 

i have a question for my labview project. Is it possible that the values in the string connection are preserved when i close the exe. That means, when i run the exe (application) build in labview, the written parameters and data i previously wrote would be preserved. 

If we understand each other, when i run the exe, the program would immediately work according to the given data because now i have to stop it and set the port, storage to sql, ect... and run the application again to read parameters from controller.

I would like to set these parameters when i open the application and when i close it and open again, the parameters would be saved and the exe would immediately work.

 

below is my project.

 

Thanks, Tim

0 Kudos
Message 1 of 10
(179 Views)

@tominsek wrote:

hi, 

[...]

I would like to set these parameters when i open the application and when i close it and open again, the parameters would be saved and the exe would immediately work.

 

below is my project.

 

Thanks, Tim


Yes, save the parameters in a file, load them when the application starts and use them.

There are multiple possibilities to save these parameters in a file. For example you can use the "Configuration file VIs" from "File I/O" palette. Or you can use the Flatten/Unflatten to/from XML or json VIs in "String" palette.

0 Kudos
Message 2 of 10
(159 Views)

hi 

 

Yes you can. As previously stated you can save the configuration on a .ini file and access the parameters using the config.ini functions. 

 

In your program, the first thing it does, it reads the config ini file and updates the parameters of your program. If you change anything, the program updates the file so the next time you start the EXE the latest change will be updated. 

 

I usually have a configuration window where all the parameters can be accessed and saved after I'm done configuring it. 

 

If you can, please save the files to lv version 2020 .

 

 

 

0 Kudos
Message 3 of 10
(119 Views)

You can't change an Exe once compiled, so no. What's easy enough is to save those values to e.g. an .ini file and load them as the program starts.

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 10
(106 Views)

here is your 2020 version files...

Can you make it for me or maybe show me in other version or your project how you do it.

thanks

0 Kudos
Message 5 of 10
(97 Views)

hi, yamadea

 

do you have maybe some example of how to do that so i can imagine what you mean exactly.

 

thank you for every answer

0 Kudos
Message 6 of 10
(96 Views)

if we understand each other, when im gonna open the application , i am gonna write data for saving to sql, write serial number, write com port and all this data need to be saved when the application is opened again. if i change this data again (for example to other com port, other sql base, ect...) and close application and open again, this data need to be saved on last change.

 

And all thes must happening in exe file (application), where you cant change anything if exe file is made.

 

0 Kudos
Message 7 of 10
(90 Views)

Open the NI Example Finder and Look for the example Configuration INI

 

this example shows how you deal with config.ini file. 

You will create your own config ini with the parameters you need, for example DB table, serial configuration etc. 

 

Create a Read config file.vi that will read the config file and return the parameters you want. 

 

LVNinja_1-1754678675857.png

This subvi shall be place on the state INI of your program , it will also update the Table parameters from the Database. 

Then everytime the program initializes, the routine will read the config file and update the parameter

 

LVNinja_3-1754678920486.png

 

 

0 Kudos
Message 8 of 10
(65 Views)

Hello, Tim.

 

     LabVIEW has some very nice "file" features that work well with LabVIEW Projects and LabVIEW Built Executables.  Here's a feature that I use to have a "safe place" to store Initialization Files (.ini, in my case) and other Project-related Data Files.

 

     It starts with the fact that when you build an Executable, LabVIEW creates a file called "Data" that is in the same Folder as your Executable.  What you want to do is to place an identical file, "Data", at the top level of your Project File.  While you are working on your Project and testing your code, put your Initialization File (Tim.ini, for example) in the Project's top-level Data folder that you just created.

 

     Now look in the File Palette and notice the folder with "File Constants".  One of them is called "Application Directory".  It has the wonderful property that if you are in "development mode", it points to the top level of the Project, so to get the path name to the Data Folder in your Project, do a Build Path with Application Directory on top and the string "Data" on the bottom.  That's the path to the Data Folder in your Project.

 

     But what about when you run the same code in your Executable?  Why, it points to the Data Folder created when you built your Executable!  Same exact code works both in Development and Execution mode!

 

     You can use the same "feature" if you have other "dual-location" files.  For example, I keep my Configuration files in a "Config" folder, saving "Data" for data storage by my program.  I specify the name "Config" on the third (I think) page of the Build process (it asks if I want additional Files in my Executable).

 

     The only thing you need to remember is when you build your Executable for the first time, the Data Folder will be empty.  While you were developing your code, you were (of course) using the Data Folder in your Project, so if you saved your Config information there, you need to remember to copy it to the Data Folder created when you build your Executable.  

 

Bob Schor

0 Kudos
Message 9 of 10
(53 Views)

Hi bob schor,

 

very very thank you for that beautiful answer, you wrote that very sensibly, and i would be willing to send me your project so i can imagine how you did it. I would really like this

 

thank you, Tim

0 Kudos
Message 10 of 10
(31 Views)