BrokenArrow Posted March 19, 2007 Report Share Posted March 19, 2007 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? Quote Link to comment
PJM_labview Posted March 19, 2007 Report Share Posted March 19, 2007 QUOTE(BrokenArrow @ Mar 18 2007, 10:12 AM) 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? I think you should investigate using [wiki]OpenG[/wiki] code. There are VI that makes writing ini files setting trivial with no real estate use (see screenshot below of the help for a vi that takes a cluster for input and does all the hard work for you). http://forums.lavag.org/index.php?act=attach&type=post&id=5227 Below is the screenshot of the palette. http://forums.lavag.org/index.php?act=attach&type=post&id=5228 PJM Quote Link to comment
BrokenArrow Posted March 20, 2007 Author Report Share Posted March 20, 2007 PJM, that looks sweet. I didn't think to look in the [wiki]OpenG[/wiki] stuff. Since migrating to 8.2, I've been busy converting old programs, and haven't taken the time to install OpenG, VIPM, etc. My loss. Doing it tomorrow. Quote Link to comment
BrokenArrow Posted March 20, 2007 Author Report Share Posted March 20, 2007 QUOTE(PJM_labview @ Mar 18 2007, 01:41 PM) I think you should investigate using [wiki]OpenG[/wiki] code. There are [wiki]VI[/wiki] that makes writing ini files setting trivial with no real estate use (see screenshot below of the help for a vi that takes a cluster for input and does all the hard work for you). http://forums.lavag.org/index.php?act=attach&type=post&id=5227 Below is the screenshot of the palette. http://forums.lavag.org/index.php?act=attach&type=post&id=5228 PJM 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 Quote Link to comment
PJM_labview Posted March 20, 2007 Report Share Posted March 20, 2007 Here you go: http://forums.lavag.org/index.php?act=attach&type=post&id=5231 PJM Quote Link to comment
BrokenArrow Posted March 20, 2007 Author Report Share Posted March 20, 2007 OH! Clusters within a cluster, now I get it. Excellent, thanks. Quote Link to comment
Eugen Graf Posted March 20, 2007 Report Share Posted March 20, 2007 XML-File is very good for saving clusters into file and very simple. Eugen Quote Link to comment
BrokenArrow Posted March 20, 2007 Author Report Share Posted March 20, 2007 QUOTE(PJM_labview @ Mar 18 2007, 11:02 PM) Here you go:http://forums.lavag.org/index.php?act=attach&type=post&id=5231''>http://forums.lavag.org/index.php?act=attach&type=post&id=5231'>http://forums.lavag.org/index.php?act=attach&type=post&id=5231 PJM 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! Quote Link to comment
npoling Posted March 20, 2007 Report Share Posted March 20, 2007 I agree with Eugen, XML's are very simple to use and are very effective with all the data types. Nate Quote Link to comment
PJM_labview Posted March 20, 2007 Report Share Posted March 20, 2007 QUOTE(BrokenArrow @ Mar 19 2007, 09: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! see attached example http://forums.lavag.org/index.php?act=attach&type=post&id=5239 http://forums.lavag.org/index.php?act=attach&type=post&id=5238 PJM Quote Link to comment
Chris Davis Posted March 20, 2007 Report Share Posted March 20, 2007 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. Quote Link to comment
BrokenArrow Posted March 20, 2007 Author Report Share Posted March 20, 2007 Thanks PJM and everyone !! :worship: Quote Link to comment
Nullllll Posted March 25, 2007 Report Share Posted March 25, 2007 Waaaaaaaaaw!! I had the same problem now I can solve it Thanks LAVA Love LAVA Quote Link to comment
Mike Ashe Posted March 25, 2007 Report Share Posted March 25, 2007 Here are a couple more examples, with read write of clusters or whole VIs: http://forums.lavag.org/index.php?act=attach&type=post&id=5285 http://forums.lavag.org/index.php?act=attach&type=post&id=5286 These were originally done by Jim Kring* *credit where credit is due... Quote Link to comment
GregHicks Posted June 11, 2007 Report Share Posted June 11, 2007 QUOTE(Mike Ashe @ Mar 25 2007, 03:15 AM) Here are a couple more examples, with read write of clusters or whole VIs:http://forums.lavag.org/index.php?act=attach&type=post&id=5285 http://forums.lavag.org/index.php?act=attach&type=post&id=5286 These were originally done by Jim Kring* *credit where credit is due... 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 Quote Link to comment
BrokenArrow Posted June 11, 2007 Author Report Share Posted June 11, 2007 QUOTE(GregHicks @ Jun 10 2007, 12:19 AM) hi AllI 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 Quote Link to comment
Yair Posted June 11, 2007 Report Share Posted June 11, 2007 I posted my example over here (replies 12 & 13). I like it more because it allows working with individual controls. Quote Link to comment
GregHicks Posted June 14, 2007 Report Share Posted June 14, 2007 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: Accept an array of control references Save Indicators and Arrays 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. Quote Link to comment
BrokenArrow Posted June 14, 2007 Author Report Share Posted June 14, 2007 Greg, Simply grand. thanks! Quote Link to comment
torekp Posted July 3, 2007 Report Share Posted July 3, 2007 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. Quote Link to comment
Yair Posted July 3, 2007 Report Share Posted July 3, 2007 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). Quote Link to comment
george seifert Posted July 3, 2007 Report Share Posted July 3, 2007 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 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.