05-09-2016 01:18 PM
Today I wrote a recursive VI (my first!) that updates elements between two clusters where the clusters have named elements in common.
Some background: I have a test architecture I'm developing where each test-step's configuration, a cluster, is stored in a file. If the configuration cluster changes for a test, I'd like to be able to load the old configuration values for the new test. Usually this cluster will be the same, but it may have new elements or elements that have been removed.
The VI relies on some OpenG variant functions.The challenge here was to deal with nested clusters, and this was handled by recursion. The VI is set to shared clone re-entrancy, and cluster data types within the main cluster are handled in a reentrant call to the VI. It's an elegant solution!
I would love some feedback on this code: are there ways it could be improved? Corner cases I haven't covered?
Solved! Go to Solution.
05-10-2016 01:16 PM - edited 05-10-2016 01:18 PM
Removing (or renaming) "innercluster" in "New Cluster" produces an error in your example.
Using the Autotestware Cluster Toolkit also eliminates the need for recursion.
The Autotestware Human Readable Data Toolkit may be a great fit for the test architecture you described.
05-11-2016 05:07 AM
I use the LAVA JSON Toolkit for storing things on disk. It also uses OpenG Variant tools and recursion to handle nested clusters.
05-11-2016 02:19 PM
Thanks for the awesome feedback... I'll check my error (great catch!), and I'll look into the additional toolkits. I have been looking for a fully human readable wya to stroe my config data from clusters, so this is really awesome guys!!
05-13-2016 08:46 AM
While we're at it you might want to checkout the MGI Read/Write anything. The output looks like INI config, like OpenG, but the read and write is much faster and works better for large data structures, like clusters of clusters of arrays of clusters of arrays. This is because the read and write is just a single call to the read or write text file, where the OpenG method calls the NI INI config functions for each line in the file and can be slow for these larger structures.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
08-02-2016 02:47 PM
I have updated my code, which is now robust to missing cluster-within-cluster.