Jump to content

Saving VI settings to a file


Recommended Posts

Of the multitude of ways to save "settings" to a file, what is your preferred method? Keys (ini), Datalog, Spreadsheet, pure text, etc... they all have drawbacks. Typically, I need to save numeric and string and boolean data - flat or structured, 3 things to 50 or more. The "keys" method gets HUGE (real estate), although the resulting file is elegant. Datalog is simple - just bundle the stuff up and send it on - but the file is unreadable (by eyes) and making changes to the data types in the VI mandates changes to the "file writer" VI. Spreadsheet String to File needs to have numbers converted, then back again.

Any tips? :throwpc:

Link to comment

QUOTE(PJM_labview @ Mar 18 2007, 01:41 PM)

I just tried some of this stuff. While it's probably the bee's knees, I can't get it to work. The file is always empty. I probably don't fully understand what they mean by "section cluster". Any examples out there?

-Richard

Link to comment

QUOTE(PJM_labview @ Mar 18 2007, 11:02 PM)

I'm unsure how to read the value back into the controls - the outputs of the read VIs are variant data. I can read one key at a time, but that would take 50 or 60 key reads!

Link to comment

QUOTE(BrokenArrow @ Mar 19 2007, 10:15 AM)

I'm unsure how to read the value back into the controls - the outputs of the read VIs are variant data. I can read one key at a time, but that would take 50 or 60 key reads!

Use the primitive "Variant to Data" and wire your cluster into the type input. You'll get your cluster out with values filled in from your INI file on the output side.

Link to comment
  • 2 months later...

QUOTE(Mike Ashe @ Mar 25 2007, 03:15 AM)

hi All

I had the same problem, and I solved it using a set of sub VI's and XML file... saved the state of every control and restored on open...

check out this Beta LLB for this job :)

Link to comment

QUOTE(GregHicks @ Jun 10 2007, 12:19 AM)

hi All

I had the same problem, and I solved it using a set of sub VI's and XML file... saved the state of every control and restored on open...

check out this Beta LLB for this job :)

WOW... 12:19 AM on a Sunday!

Thanks, those are good ideas, if not a bit complicated (lots of VIs). Can you supply a "My VI" with lots of controls (including a cluster or two) showing how to use these VI's?

-Richard

Link to comment

QUOTE(BrokenArrow @ Jun 10 2007, 11:10 PM)

WOW... 12:19 AM on a Sunday!

Thanks, those are good ideas, if not a bit complicated (lots of VIs). Can you supply a "My VI" with lots of controls (including a cluster or two) showing how to use these VI's?

-Richard

Hi Broken Arrow

Yes there are a lot of VI's. The main one is Panel State, just wire that up into the main VI of your application.

There is no reason why the Panel State can't be modified to:

  1. Accept an array of control references
  2. Save Indicators and Arrays
  3. include size to enable a "serial" xml or other output of choice for the application state

Any suggestions are welcome and I will include and upload to the snippets area.

Link to comment
  • 3 weeks later...

Thanks for all the great ideas guys. I wonder, is there any way to make the files not only human-readable but also very user-friendly, for example by putting HTML tags/bookmarks into it so the reader can jump to the parts he considers interesting? Some of my programs have a very large number of settings.

Link to comment

QUOTE(torekp @ Jul 2 2007, 06:46 PM)

I wonder, is there any way to make the files not only human-readable but also very user-friendly

You could make them XML or HTML and then use a program like XML Notepad to view and edit them, but it's not worth it. Instead, simply create an options dialog in your program which will be responsible for writing the data to the file. That way, you can split up the options into as many screens as needed (look at the LabVIEW options dialog for an example).

Link to comment

QUOTE(yen @ Jul 2 2007, 11:46 AM)

You could make them XML or HTML and then use a program like XML Notepad to view and edit them, but it's not worth it. Instead, simply create an options dialog in your program which will be responsible for writing the data to the file. That way, you can split up the options into as many screens as needed (look at the LabVIEW options dialog for an example).

I'll second that idea. I've tried a lot of different options, but this works the best. I have type def'd controls for the page that the user sees. They're limited to valid entries for everything that I can put limits on.

George

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.