LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Store value for later use

The benefit of the XML ofcourse being that you CAN read and change it with notepad, should you need to and no 3rd part code.

It should also work if you make some changes to the cluster, in which case a binary file breaks.

Normal ini-files are prettier and easier to read though. 🙂

(I've made a general ini-file handler, probably similar to the open-g one, though i haven't looked at that one.)

 

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 11 of 16
(676 Views)

A word of caution - if you have a cluster directly "Write To Binary File" and you later change the cluster, all your previous config files will be useless - in fact you unknowingly may start getting corrupted data even if you changed something in the cluster order. XML or text-based is readable by all but it can be made to have the benefit of being forward and backward-compatible.

 

-DP

 

(If you don't want others to read your text file, just encrypt the data before you write it in a config file and decrypt when you read it back - you could use something simple, or more involved like SHA1/MD5+salt.)

 

--------------------------------------------------------

New Controls & Indicators made using vector graphics & animations? Click below for Pebbles UI


Message 12 of 16
(655 Views)

@BTC_Admin wrote:

A word of caution - if you have a cluster directly "Write To Binary File" and you later change the cluster, all your previous config files will be useless - in fact you unknowingly may start getting corrupted data even if you changed something in the cluster order. XML or text-based is readable by all but it can be made to have the benefit of being forward and backward-compatible.

 

-DP

 

(If you don't want others to read your text file, just encrypt the data before you write it in a config file and decrypt when you read it back - you could use something simple, or more involved like SHA1/MD5+salt.)

 


I've been using the OpenG config files for years. I tried XML once and had some real problems. In OpenG if I change or remove one control I'll lose that value until I write to the new value. In XML all of the values would vanish or would not be unreadable or even crash the read vi. XML has it's place but not storing control default values.

PaulG.

LabVIEW versions 5.0 - 2020

“All programmers are optimists”
― Frederick P. Brooks Jr.
0 Kudos
Message 13 of 16
(603 Views)

@PaulG. wrote:
I've been using the OpenG config files for years. I tried XML once and had some real problems. In OpenG if I change or remove one control I'll lose that value until I write to the new value. In XML all of the values would vanish or would not be unreadable or even crash the read vi. XML has it's place but not storing control default values.

Just to clarify - this problem has nothing to do with XML. XML is simply a representation format and has nothing to do with whether you do or do not lose old values when you change the cluster. NI's built-in R/W XML schema primitives don't save the old data (at least not the last time I looked, and I doubt this changed), but I believe JKI's EasyXML does (although it's been years since I played with it).

 

It's simply a matter of implementing the code which will know to only load the relevant values on load, not a matter of the save format itself.


___________________
Try to take over the world!
0 Kudos
Message 14 of 16
(586 Views)

When I use OpenG to read/write cluster values via Config I have no issues at all when I change the cluster, except for losing the data for that one changed control. I can still read from the remainder of the control. Maybe I was doing it wrong but when I tried the same thing with XML I would get errors and lose all data from the cluster. XML just seemed to be a little too wonky and sensitive to changes to the cluster.

 

I banged on it for an hour or two and just gave up. It wasn't my code to begin so I re-wrote that portion to OpenG. Smiley Happy

PaulG.

LabVIEW versions 5.0 - 2020

“All programmers are optimists”
― Frederick P. Brooks Jr.
0 Kudos
Message 15 of 16
(579 Views)

@PaulG. wrote:

When I use OpenG to read/write cluster values via Config I have no issues at all when I change the cluster, except for losing the data for that one changed control. I can still read from the remainder of the control.


I know. That's exactly the reason why I also use those VIs. My point was that the reason this wasn't happening when you were using XML had nothing to do with XML as a format, but was simply a matter of the code used to read and write. Like I said, I think EasyXML does keep the values.


___________________
Try to take over the world!
0 Kudos
Message 16 of 16
(573 Views)