03-11-2020 10:12 AM
I am trying to use the Read and Write INI Cluster VI by OpenG. They look straight forward, but I can't get them to work. In the attached code, the top section won't write cluster into ini file as expected, and I have no idea why. I did notice one thing. It seems the data within the cluster doesn't have names when I debug the code. Anybody with experience with this? Thanks!
Solved! Go to Solution.
03-11-2020 11:13 AM - edited 03-11-2020 11:16 AM
Use a "Close Config Data" VI after writing your cluster.
03-16-2020 05:30 PM
That's a great catch. I am still seeing other issues. Are there any general advices on using these VIs such as naming? Thanks!
03-16-2020 05:45 PM
That seemed to do the trick for me. I think how the naming propagates to the INI file depends a bit on your data structure. For example, if it's a single cluster or a cluster of clusters, it might behave differently.
You may want to give a look at the MGI Read/Write Anything toolkit. That's generally what I use for config files, and it is pretty fast even for larger data sizes.
03-17-2020 02:11 AM
@jyang72211 wrote:
That's a great catch. I am still seeing other issues. Are there any general advices on using these VIs such as naming? Thanks!
I think you might want to break out those clusters inside and save them separately. I use the OpenG VIs that you are using, but I never have clusters within clusters. You figure that an ini file can only handle two levels of organization - sections and keywords. Clusters within clusters might confuse the VIs.
03-17-2020 05:00 AM
I did an ini writer/reader of my own, and solve Cluster in cluster by setting the section name to [top cluster name-lower cluster name]
Should you give the same name to several fields it'll bomb.
/Y
03-19-2020 10:51 AM
Did you mean the data type should always be a single cluster which represent a section of the INI file?
03-19-2020 11:08 AM
@jyang72211 wrote:
Did you mean the data type should always be a single cluster which represent a section of the INI file?
I don't know if it has to be, but to me it doesn't make sense to have a data structure that is deeper than that. Now I've never had reason to save a whole cluster to a keyword in the ini file using the OpenG ini VIs, so I don't really know if it will do this correctly.
03-20-2020 04:08 AM
@jyang72211 wrote:
Did you mean the data type should always be a single cluster which represent a section of the INI file?
I don't know how the OpenG version handles it, but mine requires data to be in a cluster or array.
It came about as a way to read/write ini-files with system settings easier. As i had them in a cluster it became natural to develop it so:
[Clustername = section name]
Control name = Key name
...
Control name = Key name
Check it out.
/Y